Data URL/base64 url in variable turns to 'invalid PDF structure'

Which product are you using?

PDF.js Express Viewer

PDF.js Express Version

:8080/lib/ui/index.h…=1&subzero=1&id=4:1 Uncaught (in promise) InvalidPDFException {message: 'Invalid PDF structure.', name: 'InvalidPDFException'}

Detailed description of issue
{I put the dataURL for my pdf file in a variable so i dont have to paste it directly into the code. when i put the variable where my url should go, then it says that my pdf structure is invalid}

Expected behaviour
{since the content of my variable is a string it should work like the noral url but its doesnt}

Does your issue happen with every document, or just one?
{every one}

Link to document
{Provide a link to the document in question if possible(the variable is called dataURL)}

Code snippet
{ initialDoc: dataURL,}

Hi @mustapha,

Can you please send the code sample you used to try and load the base64 URL? Also the URL itself.

Best Regards,
Zach Serviss
Platform Support Engineer

Thank you but I already found the solution. i just had to use “module.export” on the base64 url so i could use it in the Webviewer file

Glad that worked out for you, thanks for letting us know!

Best regards,
Kevin Kim