gpt4 book ai didi

c# - 如何在 .NET 中获取 pdf 文档中页面的方向?

转载 作者:太空宇宙 更新时间:2023-11-03 22:04:29 25 4
gpt4 key购买 nike

如何在 .NET 中获取 pdf 文档中页面的方向?pdf 文档可能包含纵向和横向页面......正确吗?

如有任何帮助,我们将不胜感激。

最佳答案

使用 iTextSharp 你可以很容易地做到这一点:

''//File to test
Dim TestFileName = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.pdf")
''//Create an object to read the PDF
Dim Reader As New iTextSharp.text.pdf.PdfReader(TestFileName)
''//Get the page size of the first page (iTextSharp page numbers start at 1)
Dim Rect = Reader.GetPageSize(1)
''//Compare the dimensions of the rectangle returned. For simplicity I'm saying that a square object is portraint, too
Dim IsPortrait = Rect.Height >= Rect.Width

关于c# - 如何在 .NET 中获取 pdf 文档中页面的方向?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8941882/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com