简体   繁体   中英

Get PDF page size with iTextSharp

I have a PDF document that I just received via file upload (InputFile).

I'd like to use iTextSharp to check it's page size before proceeding. For example, the size of a pdf when you go to file > Properties > Description Tab > Page Size (in acrobat).

Any advice on how I can do that?

THANKS!

You need to read the pdf from your input stream (m).

PdfReader reader = new PdfReader(m);
// Page size
Rectangle pagesize = reader.GetPageSize(1);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM