1
votes

I have an issue with PDF rendering using the CGContextDrawPDFPage function. I develop an iPad app (targeting iOS 7) that does very specific things with PDF, and I cannot use UIWebView so please don't suggest it. One of our customers reports a white page being rendered while every other PDF viewer renders the PDF just fine.

To make sure I don't have any dumb errors in my own code, I have taken Apple's ZoomingPDFViewer (https://developer.apple.com/library/ios/samplecode/ZoomingPDFViewer/Introduction/Intro.html), replaced the PDF they ship with the one from our customer, and started it: indeed a white page is being rendered in stead of the proper contents (a scan from a building blueprint.)

I am 100% certain is the not the loading, viewing or rendering code in the ZoomingPDFViewer example from Apple, because every other PDF file I try to view with the example renders just fine!

I'm trying to obtain permission to upload the PDF here, but I don't have it yet, so my question is: without access to the PDF that's being rendered wrongly, has anyone any idea on what this might be? Are there any limits in the PDF renderer that might cause a white page to be rendered?

Thanks in advance!

edit: The PDF is rendered perfectly in every other PDF viewer, including but not limited to the iPad email application (!), Safari on Mac OS X, Preview on Mac OS X, Acrobat Reader on Windows, FoxIt reader on Windows.

edit: converting the original PDF file (which was a pdf 1.3) to a pdf 1.5 using ghostscript on Linux solved the issue: the PDF is now properly displayed! I used the following commandline:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH -sOutputFile="filename.pdf" "filename.pdf"

1
Do you get this on the simulator or on the device, or both? Can you open the PDF in preview on Mac and does it render correctly? How big / complex is it (blueprints tend to consist of millions of line fragments, not the best thing to show on iOS). The iOS viewer in general tends to behave like an old level-1 or level-2 PostScript RIP. It has many memory issues and implementation limits and doesn't display quite a few "modern" PDF features. Overprint isn't supported just to name one. Depending on how your PDF is built, this could easily be the cause of what you see.David van Driessche

1 Answers

0
votes

The iOS pdf rendering engine does not support JPEG2000 images. If your scanned image is such an image then it will not be displayed.