UIViewをPDFとして印刷しようとしています。
問題は、UIViewがページよりも高い場合、UIViewが切り取られることです。
したがって、私がやりたいのは、UIViewの「ページの高さ」を繰り返し処理し、それぞれをPDFページとしてレンダリングすることです。
これが私のコードです:
UIGraphicsBeginPDFContextToData(pdfData, CGRectMake(0, 0, 400, 782), nil);
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
UIGraphicsBeginPDFPage();
// draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
[self.receiptContentView.layer renderInContext:pdfContext];
UIGraphicsBeginPDFPage();
// draws rect to the view and thus this is captured by UIGraphicsBeginPDFContextToData
[self.receiptContentView.layer renderInContext:pdfContext];
// remove PDF rendering context
UIGraphicsEndPDFContext();
明らかに、現時点では、各ページで同じものをレンダリングしているだけです。
上記のコードを「1ページ目に最初の782pxのみを印刷し、次に2ページ目に次の782pxを印刷する」と言うにはどうすればよいですか?
どうもありがとう。