PDF rendering with white lines top / bottom, left / right edges

I use (excellent) vfr-reader in several iOS apps. It works like a charm, but I'm having trouble rendering some PDF files.

In VFR-Reader, I see white lines at the top and bottom and / or left and right edges, which is very annoying full-page photos.

They are displayed on the page rendering and page thumbnails in the ThumbsViewController:

enter image description herePage Thumbnails with White Lines on Left and Right Edge

White lines become (slightly) larger when zoomed:

(bottom edge, although difficult to see against the white page)

zoomed in

and I can change their color by changing

CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White 

in ReaderContentPage.m / drawLayer.

I naively tried to set RGBFillColor to black, but then all the text pages (usually on a white background) in PDF would also look black.

I assume that the problem lies in some aspects of the aspect ratio / PDF format, which for some reason do not completely fill the drawing area, so the white background color β€œexpires”.

PDF files themselves seem beautiful, they display perfectly (without white lines) in Safari and GoodReader.

I would be grateful how to fix this, or the general direction that I should explore.

+4
source share
1 answer

The author of VFR answered me by email:

"I suspect this is because the PDF page size does not match the size of the supported CATiledLayer UView that the page displays. When the PDF page is created by iOS, it matches the aspect, leaving white borders. In ReaderContentPage.m, in -drawLayer: inContext: method, try changing true to false in this function call: CGPDFPageGetDrawingTransform (_PDFPageRef, kCGPDFCropBox, self.bounds, 0, true) "

which really fixed the problem!

(To fix the thumbnails, I changed the same line in ReaderThumbRender.m)

+4
source

All Articles