【问题标题】:PDFsharp: How to find the Size dimensions of all the pages in a PDF file?PDFsharp:如何查找 PDF 文件中所有页面的大小尺寸?
【发布时间】:2019-01-08 11:02:48
【问题描述】:

我正在使用 PDFsharp,这是处理 PDF 的绝佳工具。
我正在 VB.net 中编写一个应用程序来处理印刷行业的 PDF。我需要知道如何找出 PDF 每一页的尺寸。

【问题讨论】:

    标签: vb.net pdfsharp


    【解决方案1】:

    循环浏览 PDF 中的所有页面并查询每个页面的页面大小。

    使用PdfDocument 对象的Pages 属性。

    【讨论】:

      【解决方案2】:
      Function GetPDFMetaData(ByRef pSourceFile As OpenFileDialog)
          Dim lpdfDocument As PdfDocument = PdfReader.Open(pSourceFile.FileName, PdfDocumentOpenMode.Import)
          Dim lpdfpage As PdfPage
          Dim Text As String = ""
          Dim Width As Integer
          Dim Height As Integer
      
          For idx As Integer = 0 To lpdfDocument.PageCount - 1
              lpdfpage = lpdfDocument.Pages(idx)
              Width = lpdfpage.Width.Millimeter
              Height = lpdfpage.Height.Millimeter
              Text = Text & vbCrLf & "Page: (" & idx + 1 & "); Size =(" & Width & " X " & Height & ")"
          Next
          Return Text
      End Function
      

      【讨论】:

        猜你喜欢
        • 2011-04-22
        • 2014-01-21
        • 2012-11-18
        • 2015-02-16
        • 2010-12-22
        • 1970-01-01
        • 1970-01-01
        • 2017-11-28
        • 1970-01-01
        相关资源
        最近更新 更多