使用iTextSharp获取PDF页面大小(Get PDF page size with iTextSharp)

编程入门 行业动态 更新时间:2024-10-25 04:22:48
使用iTextSharp获取PDF页面大小(Get PDF page size with iTextSharp)

我有一个PDF文档,我刚刚通过文件上传(InputFile)收到。

我想在继续之前使用iTextSharp来检查它的页面大小。 例如,当您转到文件>属性>描述选项卡>页面大小(在acrobat中)时,pdf的大小。

有关如何做到这一点的任何建议?

谢谢!

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!

最满意答案

您需要从输入流中读取pdf。

PdfReader reader = new PdfReader(m); PdfImportedPage page = writer.GetImportedPage(reader, i); // size information //page.PageSize.Width //page.PageSize.Height

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

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

更多推荐

本文发布于:2023-08-04 10:01:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1415139.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:大小   页面   PDF   iTextSharp   page

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!