简体   繁体   English

使用iTextSharp获取PDF页面大小

[英]Get PDF page size with iTextSharp

I have a PDF document that I just received via file upload (InputFile). 我有一个通过文件上传(InputFile)刚收到的PDF文档。

I'd like to use iTextSharp to check it's page size before proceeding. 我想在继续操作之前使用iTextSharp检查它的页面大小。 For example, the size of a pdf when you go to file > Properties > Description Tab > Page Size (in acrobat). 例如,当您转到文件>属性>描述标签>页面大小时,pdf的大小(在acrobat中)。

Any advice on how I can do that? 关于我该如何做的任何建议?

THANKS! 谢谢!

You need to read the pdf from your input stream (m). 您需要从输入流(m)中读取pdf。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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