The dimensions are gotten by
String pdf = "D:\\images\\example.pdf";
com.itextpdf.text.pdf.PdfReader reader = new
com.itextpdf.text.pdf.PdfReader(pdf);
com.itextpdf.text.pdf.PdfImportedPage page = writer.getImportedPage(reader, 1);
System.out.println("width " + page.getWidth() + " height " + page.getHeight());
The width is 612 and height is 792.
Op 10/09/2012 17:42, Segev, Eli schreef:
I am reposting my question, since I don't see how I can reply to a topic:
I have a file that when opened with Adobe Reader, it is displayed as 792x612.
But when the page is loaded in iText, it says that the dimensions are 612x792.
Why the discrepancy?
Your question "When the page is loaded in iText, it says that the dimensions
are 612x792" is invalid.
It is invalid because it's impossible to find out what you mean by "When the
page is loaded in iText" and what is saying that "the dimensions are 612x792".
Attached is a screenshot showing the page dictionary of the first page of your
document. As you can see, the page size is 612x792 if you ask for the MediaBox
using getPageSize(); However, when you use getPageRotation(), you'll find out
that the page needs to be rotated by 90 degrees. If the page had a CropBox that
is smaller than the MediaBox, then the page size as shown by Adobe Reader will
be smaller than the size returned by getPageSize(). You'll need getCropBox() to
find the correct dimensions.
-------------------
Eli Segev
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php