Is there a way to load a PDF from base64 data?
See original GitHub issueLoading a PDF from react-pdf worked this way, could anyone help me out with this?
I’m getting a PDFDocument: stream must have data
error whenever I try to load my PDF’s
<PDF
file={`data:application/pdf;base64,${this.state.base64}`}
onDocumentComplete={this.onDocumentComplete}
onPageComplete={this.onPageComplete}
page={this.state.page}
/>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Opening PDF String in new window with javascript
If you are able to pass the content from the backend encoded you can use.. window. open("data:application/pdf;base64, " + base64EncodedPDF);
Read more >How to load the PDF document as base64 string in PDF Viewer
You can load the PDF document as base64 string in the PDF Viewer using the documentPath API during the control initialization. The name,...
Read more >Opening a document in WebViewer from base64 data - PDFTron
If you have the file data as a base64 string, the best way to load the document in WebViewer is to first convert...
Read more >Downloading a base 64 PDF from an api request in Javascript.
It creates an anchor tag element assigned to the constant downloadLink , uses the base64 pdf along with “data:application/pdf;base64” as a ...
Read more >How to display ("data:application/pdf;base64," + pdfData) in ...
Just for the record: pdf.js is able to display PDF files encoded as base64 strings. Maybe the problem of @kakaluote444 is that the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Basically,
react-pdf-js
supports base 64 string. Different fromreact-pdf
, it is not required to separate the data typedata:application/pdf;base64
from the date string in this library. Here is an example, and it works to me.this approach is not working in iphone safari