Some PDFs display blank white page
I cant seem to work out what is causing this, but some PDFs that get fed to it are displaying as blank white pages. If I take those PDFs and re-save them in something like Preview, then it works, so I"m guessing it's something to do with the way in which they were exported.
Has anyone come across this? Not sure how to troubleshoot as I cant reliably replicate 🤔
@tomlongo
I had the same problem with a couple of PDFs there were created with an old version of Ghostscript (which had a documented bug).
The only way I found to overcome the problem has been to use a recent version of gs to re-save them, e.g. gs -sDEVICE=pdfwrite -oCorrect_PDF.pdf Problematic_PDF.pdf .
That said, I can't understand why Preview, iBooks and iOS 11 PDFKit (which I'd prefer not to use for my particular app because of the way the thumbnail bar behaves) all can correctly open the original PDFs.
@Alua-Kinzhebayeva Any solution for this?
This seems to be related with this one.
I've changed changed the rotation code blocks with the following on PDFDocument & TiledView.
// Flip the context so that the PDF page is rendered right side up.
context.translateBy(x: 0.0, y: scaledPageRect.height)
context.scaleBy(x: 1.0, y: -1.0)
let transform = page.getDrawingTransform(CGPDFBox.mediaBox, rect: scaledPageRect, rotate: 0, preserveAspectRatio: true)
context.concatenate(transform)
These changes seems to fixed the issue in my case.