Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have Pdf document with multiple page count
For ex: A.Pdf have 6 pages
B.Pdf have 20 page

I want to get height and width of pdf document

I have tried using Itextsharp but its not working for me



Please help me on this

What I have tried:

C#
iTextSharp.text.pdf.PdfReader pdfReader = new iTextSharp.text.pdf.PdfReader(fileNames[i]);

                    
                    Rectangle psize = pdfReader.GetPageSize(1);



and output is:

Rectangle: 612x792 (rot: 0 degrees)


I want to get output in inches
Posted
Updated 18-Jan-17 8:36am
v4
Comments
Richard MacCutchan 18-Jan-17 4:57am    
Then you need to convert those numbers (whatever they are) to inches.

1 solution

The rectangle width and height are measured in points.

There are 72 points to an inch.

Therefore, you need to divide the returned values by 72 to get the size in inches (8.5" × 11").
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900