PDF page height and width

I want to get the height and width of a PDF page in my application. How to do it?

+3


source to share


2 answers


you can get it this way



float width = CGPDFPageGetBoxRect(pdfPageRef, kCGPDFMediaBox).size.width;
float height = CGPDFPageGetBoxRect(pdfPageRef, kCGPDFMediaBox).size.height;

      

+8


source


If you have PDFDocument document

you can get the page:

PDFPage *page = [document pageAtIndex:pageIndex];

      



Based on Vignesh's answer, you can do the following with a page:

CGFloat pageWidth = CGPDFPageGetBoxRect(page.pageRef, kCGPDFMediaBox).size.width;
CGFloat pageHeight = CGPDFPageGetBoxRect(page.pageRef, kCGPDFMediaBox).size.height;

      

0


source







All Articles