In our apps, we are diplaying PDFs using the PDF Reader component in Appfarm. This usually works very well, apart from the following two cases.
The pages in some PDFs will overlap when using the PDF reader component (the content is cut). See image below (1). Not sure how to deal with this, or if something is wrongly set up in our app. Might be because the PDF is wrongly oriented compared to the phone orientation, but it should display the whole page nonetheless.
For some bigger one-paged files (> approx. 13 MB) the PDF reader loads for a while before reloading the app, sometimes also crashing it entirely (on both iOS and Android). See images below (2,3).
The PDF reader is the only component inside of a fullscreen dialog.
Is there something I can do about this, apart from asking the users of the app to upload smaller PDFs? A workaround could be to use the Open URL action node to display the file in browser (using “Open in new”), but the behaviour is non-consistent when it comes to displaying or downloading the file (based on users browser settings).
PDFs can be provided. Any help would be very appreciated!
I haven’t looked in the first case yet, but for the second PDF that crashes the tab, I have a hunch that it might be related to how the PDF is made.
It consists of many large image layers. When Appfarm attempts to render the PDF in the PDF reader, the Service Worker responsible for processing the PDF is blocked when attempting to decode the large images. This is memory intensive and also blocking. In some browsers, like iOS Safari, a tab is very restricted in how much memory it is allowed to use, and it will crash/be killed when consuming too much memory.
Opening the PDF in the built-in iOS PDF reader also results in a crash, so this points to an issue outside of Appfarm.
If anyone else want to inspect their PDFs, they can use: pdfImages --list <path to pdf here> - to list all image layers in the PDF pdfInfo <path to pdf here> - display general information about the PDF
This might be useful if you are experiencing PDF issues in Appfarm.
I have registered a ticket for the first PDF being rotated, but I am not sure we can do much for the second PDF.