我正在尝试渲染 pdf 文档的页面。在 Adobe Reader 中打开 pdf 可以正确显示页面。当我尝试将其渲染到视图中时,我会在屏幕边缘看到额外的“项目”。它们看起来像指南和页面创建日期。我已经尝试使用所有 PDFBox 选项,但我无法找到正确的选项。我正在使用 TiledPDFView 类来呈现页面。它使用CATiledLayer
类。以下是相关方法。
-(void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
CGContextSetRGBFillColor(ctx, 1.0,1.0,1.0,1.0);
CGContextFillRect(ctx, self.bounds);
CGContextSaveGState(ctx);
CGContextTranslateCTM(ctx, 0.0, self.bounds.size.height);
CGContextScaleCTM(ctx, 1.0, -1.0);
//I've tried many options in the PDFBox parameter.
CGContextConcatCTM(ctx, CGPDFPageGetDrawingTransform(pdfPage, kCGPDFCropBox, self.bounds, 0, false));
CGContextDrawPDFPage(ctx, pdfPage);
CGContextRestoreGState(ctx);
}
我真的不确定如何删除这些准则。这可能只是我的界限问题。