iText: how to detect if a pdf page is LETTER or LEGAL size
I have a pdf documents that contains mixture of LETTER and LEGAL size, and I need to detect pages with LEGAL size and reduce to LETTER size. Can I do this with iText? sample code would be greatly appreciated. Thank you so much开发者_高级运维.
Either use
- http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfReader.html#getPageSize(int)
- http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfReader.html#getPageSizeWithRotation(int)
Compare the width and height of the Rectangle you get out of this and you know what paper size you're using.
精彩评论