How to set the Legal Page size for PDF created using UIPrintPageRenderer?

两盒软妹~` 提交于 2020-08-06 04:33:47

问题


I am setting this:

static CGFloat LegalPageWidth = 612.0;
static CGFloat LegalPageHeight = 1008.0;

as legal page size (i.e 8.5 x 14 inch) for PDF creation in UIPrintPageRenderer as "paperRect" but when I print the PDF its size is always A4 (i.e 612 x 792 = 8.5 x 11 inch).

What is the correct way to get Legal Page size PDF ?


回答1:


The UIGraphicsBeginPDFPage creates the new page using the default size while the UIGraphicsBeginPDFPageWithInfo function lets you customize the page size or customize other aspects of the PDF page.

Refer this https://developer.apple.com/library/archive/documentation/2DDrawing/Conceptual/DrawingPrintingiOS/GeneratingPDF/GeneratingPDF.html#//apple_ref/doc/uid/TP40010156-CH10-SW3



来源:https://stackoverflow.com/questions/61610999/how-to-set-the-legal-page-size-for-pdf-created-using-uiprintpagerenderer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!