iPadアプリでは、アップルのコードavailable hereに基づいて、1年以上前からよく使用されていますこれまでに何十種類もの異なるPDFがありました。私はいくつかの方法で色が歪んでいるように見えるたくさんのPDFを手に入れました。何プレビュー/ Adobeは示していますPDFの色はウェブビューとCGPDFDocumentCreateで変わっていますが、プレビューにはまだありません
そして、ここでは、私が見ているものだ、両方のレイヤーでのシミュレータを使用して、(ファイルを指す)のiPadのUIWebViewでCGPDFDrawPDFPage()
とをもと:
何らかの理由でPDFが奇妙な色空間(CMYK?)になっているのですが、プレビュー/ Adobe Readerでそれを開けるのはなぜか分かりません。参考までに、これはUIViewのサブクラスに使用される表示コードの和全体(ノート、pdfPage
はインスタンス変数である)である:
// Draw the CGPDFPageRef into the layer at the correct scale.
-(void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context
{
// from https://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints
CGContextSetInterpolationQuality(context, kCGInterpolationHigh);
CGContextSetRenderingIntent(context, kCGRenderingIntentDefault);
// First fill the background with white.
CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f);
CGContextFillRect(context, self.bounds);
CGContextSaveGState(context);
// Flip the context so that the PDF page is rendered
// right side up (all the PDF routines are built for Mac OS X
// coordinate systems, where Y is upwards.
// first move the origin down by the full height
CGContextTranslateCTM(context, 0.0f, self.bounds.size.height);
// now invert the Y position (scale by -1)
CGContextScaleCTM(context, 1.0f, -1.0f);
// Scale the context so that the PDF page is rendered
// at the correct size for the zoom level.
CGContextScaleCTM(context, myScale, myScale);
CGContextDrawPDFPage(context, pdfPage);
CGContextRestoreGState(context);
}
あなたが見ることができるように、我々はまた、Fast and Lean PDF Viewer for iPhone/iPad/iOs - tips and hints?
の熱心な読者でした私たちが見ているものを診断する方法や色空間を変更する方法(あるいはPDF文書を変更する方法など)に関する提案はありますか?
ありがとうございましたDerek - これらは私たちによって作成されたものではなく、私たちが作成したものではありません。 –