Quote:
Originally Posted by lukeirvin
I'm making a PDF that I can email or save. I can't figure how how to set the size of the PDF though. Right now I'm capturing the view as an image and placing it in a PDF format.
This is what I am doing:
Code:
NSMutableData * pdfData = [NSMutableData data];
UIGraphicsBeginPDFContextToData(pdfData, self.view.bounds, nil);
UIGraphicsBeginPDFPage();
CGContextRef pdfContext = UIGraphicsGetCurrentContext();
[secondViewController.layer renderInContext:pdfContext];
UIGraphicsEndPDFContext();
How do I set the size?
|
Set it with the bounds (reference docs):
bounds
A rectangle that specifies the default size and location of PDF pages. (This value is used as the default media box for each new page.) The origin of the rectangle should typically be (0, 0). Specifying an empty rectangle (CGRectZero) sets the default page size to 8.5 by 11 inches (612 by 792 points).
James