问题
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