I have an application coded in objective-c that is using CoreGraphics and CGPDFDocument, it's a PDF reader.
With the release of iOS 15 I'm having problems with the rendering of certain pages in certain PDF files. The problem is not present with PDFKit.
I have also downloaded the ZoomingPDFViewer example https://developer.apple.com/library/archive/samplecode/ZoomingPDFViewer/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010281 from the official apple documentation page and I see that the same thing happens.
Since I have posted a workaround over at the Apple Developer Forums, I wanted to share it here as well. https://developer.apple.com/forums/thread/695439
I can confirm that this problem occurs since iOS 15. As far as I am concerned, I think it is due to a mismapping of the color space, in particular the alpha channel, when rendering the image to the PDF drawing context.
However, I have found a small workaround for the time being. That is setting the bitmap drawing context to non-opaque.
UIGraphicsBeginImageContextWithOptions(size, NO, 0.0);
Regarding the CATiledLayer (used in the ZoomingPDFViewer example), one can simply set the opaque flag to false.
CATiledLayer *tiledLayer = (CATiledLayer *)[self layer];
tiledLayer.opaque = NO;
Of course, it would be ideal if Apple could fix this issue in a future release of iOS. Until then, I hope you find my workaround useful.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.