获取注释状态接受的值

时间:2019-01-14 13:05:56

标签: pdf annotations itext

我正在尝试查找一个示例以读取注释状态值。例如,注释标记为用户x接受。我想阅读注释是否被接受以及由谁接受。

但是我只能找到样本以写出接受状态。

Link so sample

这是我访问批注的代码

Public Sub GetComments()

    Dim oComments As New PDFcomments
    Dim reader As PdfReader = New PdfReader("MyPDF.pdf")
    Dim pdfdocument As New PdfDocument(reader)


    For i As Integer = 1 To pdfdocument.GetNumberOfPages

        Dim pdfPage As PdfPage = pdfdocument.GetPage(i)
        Dim oAnnotations As IList(Of Annot.PdfAnnotation) = pdfPage.GetAnnotations()


        For Each oAnnotation As Annot.PdfAnnotation In oAnnotations

            Dim oAnnotationSubType As PdfName = oAnnotation.GetSubtype

            If oAnnotationSubType.ToString = "/FreeText" Then
                Debug.Print(oAnnotation.GetTitle.ToString)
                Debug.Print(oAnnotation.GetContents.ToString)

                ' Attempt to get the annotation status. but I am stuck here.
                Dim oAnnot As PdfDictionary = oAnnotation.GetPdfObject()
                Dim oAnnotState As PdfDictionary = oAnnot.GetAsDictionary(PdfName.State)

            End If

        Next
    Next

End Sub

编辑:我进行了更多研究,发现我需要使用IRT值来获取父批注。但是我该怎么做呢?

Dim oIRT As PdfDictionary = oAnnot.GetAsDictionary(PdfName.IRT)

值为

  

{<> / C [1.0 1.0 1.0] / Contents文本/ CreationDate   D:20190114130039 + 01'00'/ DA 0.898 0.1333 0.2157 RG / Helv 20 Tf / DS   字体:Helvetica,sans-serif 20.0pt; text-align:left;颜色:#E52237 / F   4 /男D:20190114130049 + 01'00'/ NM 5bb8de62-845b-4bdf-9ec3-823aa555ee67   / P 15 0 R / RC文字

  / Rect [349.619 161.213 662.333 508.889] /旋转90 /主题文本框   / Subtype / FreeText / T JeEe / Type / Annot >>}

0 个答案:

没有答案