开发者

iText: how to detect if a pdf page is LETTER or LEGAL size

开发者 https://www.devze.com 2023-03-31 17:40 出处:网络
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 appr

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号