【发布时间】:2015-03-06 13:07:56
【问题描述】:
我在 uiwebview 中打开了 pdf 文件,在 uiwebview 子视图中添加了图像和文本。然后我尝试创建了 pdf 文件。下面的示例我用来生成 pdf 文件。单页多页书写。我怎样才能写出样品质量和确切尺寸。 请查看屏幕截图及以下来源
UIGraphicsBeginPDFContextToData( pdfData, CGRectZero, nil );
for (int i = 0; i < 10; i++) {
CGRect f = [pdfView frame];
[pdfView setFrame: f];
UIGraphicsBeginPDFPage();
CGContextRef currentContext = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(currentContext, 72, 72); // Translate for 1" margins
[[[pdfView subviews] lastObject] setContentOffset:CGPointMake(0, 648 * i) animated:NO];
[pdfView.layer renderInContext:currentContext];
}
UIGraphicsEndPDFContext();
我也尝试过以下链接,但我无法添加 uiwebview 子视图来编写 pdf。 http://b2cloud.com.au/tutorial/drawing-over-a-pdf-in-ios-pdf-template/
【问题讨论】:
标签: ios objective-c uiwebview pdf-generation uigraphicscontext