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

366 Views Asked by At

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

There are 1 best solutions below

0
On BEST ANSWER

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