我是这样创建PDF
的UIWebView
:
UIPrintPageRenderer *render = [[UIPrintPageRenderer alloc] init];
[render addPrintFormatter:_webView.viewPrintFormatter startingAtPageAtIndex:0];
CGRect printableRect;
CGRect paperRect;
printableRect = CGRectMake(10, 5, kPaperSizeA4.width-20, kPaperSizeA4.height-10);
paperRect = CGRectMake(0, 0, kPaperSizeA4.width, kPaperSizeA4.height);
[render setValue:[NSValue valueWithCGRect:paperRect] forKey:@"paperRect"];
[render setValue:[NSValue valueWithCGRect:printableRect] forKey:@"printableRect"];
NSData *pdfData = [render printToPDF];
if (pdfData) {
BOOL isSuccess = [pdfData writeToFile:aStrDocDirPath atomically:YES];
if (isSuccess)
{
NSLog(@"Created and Saved");
}
}
现在问题它的添加blank page
。created PDF
使用 abcPDF 将 HTML 转换为 PDF 时,我引用了额外的空白页。但是iOS
我们怎么能摆脱它???