0

我需要做的是查询 iTextSharp AcroField 以检查它是否旋转,如果是,则捕获旋转的值。

所以如果我有以下字段:

Dim af As iTextSharp.text.pdf.AcroFields = stamper.AcroFields
Dim afi As iTextSharp.text.pdf.AcroFields.Item 

afi = af.GetFieldItem("fieldName")

我需要做什么才能获得该特定字段的旋转(以度为单位)?

4

1 回答 1

0

一旦您拥有如上所示的 AcroField.Item,您可以像这样以度数获得场旋转:

Dim widgetDict As PdfDictionary = Nothing
Dim mkDict As PdfDictionary = Nothing
Dim rNum As PdfNumber = Nothing

widgetDict = afi.widgets(0)
If Not widgetDict Is Nothing Then
    mkDict = widgetDict.GetAsDict(PdfName.MK)
    If Not mkDict Is Nothing Then
        rNum = mkDict.GetAsNumber(PdfName.R)
        If Not rNum Is Nothing Then
            Return rNum.DoubleValue     
        End If
    End If
End If
Return 0

请记住,这只是 AcroField 的旋转。您还必须检查是否:

  • 页面本身也被旋转 (PDFReader.GetPageRotation(pageNo) )
  • 字段旋转相对于页面 (iTextSharp.text.pdf.PdfFormField.FLAGS_NOROTATE)
于 2009-06-05T21:03:57.020 回答