How do I use a base64 encoded pdf with the prebuilt viewer from PDF.js?

38 Views Asked by At

I want to use the prebuilt viewer that comes with PDF.js, but I have a requirement that the PDF must be loaded from a base64 encoded payload and not a URL.

The viewer comes prebuilt with a default pdf or the URL of the desired PDF can be passed as a URL parameter. Neither of these options will work for me.

I can see from the docs that it is possible to create a PDF from base64 encoded data. How can I render this in the prebuilt viewer once it's created?

1

There are 1 best solutions below