Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS 4.3 PDF file rendering issue
    primarykey
    data
    text
    <p>I use the following code to draw and rotate a PDF file. It works perfectly fine with <a href="http://en.wikipedia.org/wiki/IOS_%28Apple%29" rel="nofollow">iOS</a> 5.x, but under iOS 4.3 just a white page shows up with an error in the debugger:</p> <blockquote> <p>invalid `Contents': not an array of streams.</p> </blockquote> <p>The error takes place right after "CGContextDrawPDFPage(context, pdfPage);"</p> <p>Why does it work with iOS 5.x but does not 4.3.x? I tried different PDF files, but still I got the same result.</p> <p>How do I overcome this issue?</p> <p>pdfpage is defined as:</p> <pre><code>- (void)setPage:(CGPDFPageRef)newPage { CGPDFPageRelease(self-&gt;pdfPage); self-&gt;pdfPage = CGPDFPageRetain(newPage); } </code></pre> <p>the method where it happens:</p> <pre><code> -(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { // First fill the background with white. CGContextSetRGBFillColor(context, 1.0,1.0,1.0,1.0); CGContextFillRect(context,self.bounds); CGContextSaveGState(context); int rotate = CGPDFPageGetRotationAngle(pdfPage); switch (rotate) { case 0: CGContextTranslateCTM(context, 0.0, self.bounds.size.height); CGContextScaleCTM(context, 1, -1); break; case 90: CGContextScaleCTM(context, 1.0, -1.0); CGContextRotateCTM(context, -M_PI / 2); break; case 180: case -180: CGContextScaleCTM(context, 1, -1); CGContextTranslateCTM(context, self.bounds.size.width, 0); CGContextRotateCTM(context, M_PI); break; case 270: case -90: CGContextTranslateCTM(context, self.bounds.size.height, self.bounds.size.width); CGContextRotateCTM(context, M_PI / 2); CGContextScaleCTM(context, -1, 1); break; } CGContextSetInterpolationQuality(context, kCGInterpolationHigh); CGContextSetRenderingIntent(context, kCGRenderingIntentDefault); CGContextScaleCTM(context, myScale,myScale); CGContextDrawPDFPage(context, pdfPage); // the error shows up right after executing this line CGContextRestoreGState(context); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload