使用iTextSharp获取PDF页面大小 [英] Get PDF page size with iTextSharp
本文介绍了使用iTextSharp获取PDF页面大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个PDF文件,我刚刚通过文件上传(InputFile)收到。
I have a PDF document that I just received via file upload (InputFile).
我想在继续之前使用iTextSharp检查它的页面大小。例如,当你转到文件>属性>描述选项卡>页面大小(在acrobat中)时pdf的大小。
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?
感谢!
推荐答案
你需要阅读你的pdf输入流。
You need to read the pdf from your input stream.
PdfReader reader = new PdfReader(m);
PdfImportedPage page = writer.GetImportedPage(reader, i);
// size information
//page.PageSize.Width
//page.PageSize.Height
这篇关于使用iTextSharp获取PDF页面大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文