fulberto100
fulberto100

Reputation: 313

How to extract given page from a pdf file on iOS?

i want to email current page of pdf on iOS. i think i must extract the page first.

how can i extract/save a page from pdf file? i found this link: https://stackoverflow.com/questions/9238229/iphone-how-to-extract-the-pdf-pages-from-pdf-file-if-the-pdf-file-pdf-page-conta

(but i don't have HelperClass)

Upvotes: 0

Views: 1401

Answers (1)

Richard J. Ross III
Richard J. Ross III

Reputation: 55583

Try this:

CGPDFDocumentRef document;
UIGraphicsBeginImageContext(/* PDF_SIZE */);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawPDFPage(context, CGPDFDocumentGetPage(/* PDF_PAGE */));

UIImage *output = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

Upvotes: 1

Related Questions