Closed bautista225 closed 2 years ago
Hello
The PDF contents or length of document should make no difference when embedding the PDF.
Your sample code is referencing a base64 string. Unfortunately, without seeing your full code, I can only assume the issue is with your base64 string. Maybe it was corrupted in the conversion process. Also note base64 support varies by browser, it would be good to check across multiple browsers.
You can try hard-coding your base64 to take PDFObject out of the equation, and verify your base64 works as expected.
Something like the attached file base64-hardcoded.html.zip
Good morning Philip 👋
Thank you for answering so quickly!
I have made some changes to your html to allow uploading of pdfs to base64. I discovered there are some files that, if they have several pages or relative size, they aren't showing at the browser 🥴 fileUploaderToBase64.zip
Files I have tried that don't work: gre_research_validity_data (1).pdf 1r41ai10801601_fong.pdf
Files with several pages I tried that work: markdown-es.pdf
No one of the files exceeds the 5 MB. I have been trying with Google Chrome and lastest Microsoft Edge.
As I researched, I only have seen that browsers start to not showing files in base64 when they are greater than 20 or 50 MB. So I don't understand why this files are not showing...
Is it the same to you?
Hello Juan
Using your examples, if you copy the generated base64 strings and manually paste them into the src element (as in my previous example), the base64 PDFs load fine in Chrome, Safari, and Firefox. The key here is avoiding JavaScript. This validates that the browser can support the very long base64 strings in hard-coded HTML.
When switching back to JavaScript (using your dynamic file loader), the base64 PDFs load fine in Safari and Firefox. The files do not load in Chrome. This is using JavaScript, and without using PDFObject.
So I think what you've uncovered is an issue with Chrome's handling of very long base64 strings, and not an issue with PDFObject itself. Since this is not an issue with PDFObject, I will close this ticket.
Thanks, good luck
I should note that Microsoft Edge uses Chromium under the hood, so it makes sense that both Chrome and Edge exhibit the same behavior. The issue is with Chromium.
Hello 👋 First of all, thanks for sharing this nice project!!
I have a problem with a pdf of many pages. When I try to open the file "MU4S.pdf", the result shown by html is empty. MU4S.pdf
But when I call the sentence
var result = PDFObject.embed("data:application/pdf;base64," + base64File, "#OpenPdfObject");
it returns an html element like any other call.Otherwise, if I try to open "sample.pdf", it works perfectly. sample.pdf
Thanks in advance for the help :)