“Hi everyone, in my web application I display a PDF file (mbspdf) in an HTMLViewer. On desktop (Mac, Windows), everything works fine—multi-page documents display correctly. On iPhone, however, only the first page of the document is shown, and this happens in all browsers. Is there anything that can be done about this? Thanks for your responses.”
It’s a known thing I guess.
https://stackoverflow.com/a/75514788/6047977
Reason Behind the Behavior : PDFs are not supported in the mobile browsers if embedded inside an HTML page. only first page would be displayed.
And what would be an elegant solution, then? It doesn’t seem to me that rendering a PDF as an image is the right approach—even though it technically would work. The idea would be to generate an image for the user while working with the PDF in the background.
Well, if you have the MBS Xojo DynaPDF Plugin, you could render PDF pages as images and show them in the application. That also prevents people from downloading the PDF file.
I have GraffitiPDFViewer that loads the PDF file client-side and gives all of the expected features in a PDF Viewer.
Hi Anthony, I tested your viewer, but if I have a PDF file generated using MBS DynaPDF, I can’t seem to load it—it appears to have a different structure than files generated by Graffiti. So far, I haven’t succeeded. Thanks for your response.
Hi Christian, I have your DynaPDF plugin and use it to generate all my files—it works well. I found the rasterize PDF document example, and in the sample project it works perfectly, but I haven’t been able to implement it myself. I’m also not sure if my Lite license is sufficient. Thanks for your response.
I’d need a sample to see what’s going on. GraffitiPDFViewer is based on work by Mozilla that’s bundled with many web browsers, so I’d say it’s probably a limit on the size of the PDF. Rasterized PDFs, for example, may be quite large and the server may not accept large enough requests.
Hi Anthony, here I’m sending the PDF I need to display—thanks!
Archiv.zip (626.6 KB)
Both of those PDFs load as expected in GraffitiPDFViewer for me. If you have a current subscription, you should open a ticket with an example of how you’re loading them so that I can assist you further.
Hi Anthony and Christian , thank you so much for the great support—it’s working now! The issue was that I was closing the PDF incorrectly. Really appreciate your help!