PDF markup "Text Comment" changed to "Text Box" adobe acrobat reader

We are extracting and storing PDF comments made with adobe pdf in database. We are doing some manipulations needed by system and we are re importing PDF markups back to pdf document.
Everything was fine until users started to use “Text Comment” in adobe acrobat. After importing PDF markups “Text Comment” type changes to “Text Box” type. Would be OK, but TextBox has border and not all text is visible after opening pdf document you have to resize manually for text to be visible. I have attached file test_withAnottations.pdf (552.4 KB), and output.pdf (288.7 KB), where you can see converted markups.

Is there anything we could do about this?

Extracted some piece of code and also tried with 17.9.0.0 Aspose.PDF version, same results.
'---------------------------------------------------------
Dim pFilePath = “c:/temp/test_withAnottations.pdf”
Dim vOutputStream As New MemoryStream
Dim vResultStream As New MemoryStream
Dim gAnnoType As Enum = {AnnotationType.Caret, AnnotationType.Circle, AnnotationType.FileAttachment, AnnotationType.FreeText, AnnotationType.Highlight,
AnnotationType.Ink, AnnotationType.Line, AnnotationType.Link, AnnotationType.Movie, AnnotationType.Polygon, AnnotationType.PolyLine,
AnnotationType.PrinterMark, AnnotationType.Screen, AnnotationType.Popup, AnnotationType.Square,
AnnotationType.Squiggly, AnnotationType.Stamp, AnnotationType.StrikeOut, AnnotationType.Text, AnnotationType.TrapNet,
AnnotationType.Underline, AnnotationType.Watermark, AnnotationType.Widget}

    Dim annotationEditor As New PdfAnnotationEditor()
    annotationEditor.BindPdf(pFilePath)
    Dim vBuffer As Byte() = {}

    Using vMemStream As New MemoryStream
        annotationEditor.ExportAnnotationsXfdf(vMemStream, 0, 1, gAnnoType)
        vBuffer = vMemStream.GetBuffer
        vOutputStream.Position = 0
        vOutputStream.CopyTo(vMemStream)
    End Using

    Dim vInitialString As String = Encoding.UTF8.GetString(vBuffer)
    Dim vBegin As Integer = vInitialString.IndexOf("<", 0)
    vInitialString = vInitialString.Substring(vBegin)

    Dim vXMLString As New String(vInitialString.ToCharArray)

    Dim vXMLStringReader As New StringReader(vXMLString)

    Dim vXMLDoc As New XmlDocument
    InitializeAnnotationsTable()
    vXMLDoc.Load(vXMLStringReader)
    Dim vXMLAnnots As XmlNodeList = vXMLDoc.GetElementsByTagName("annots")
    Dim vAnnotationsTypes As New Dictionary(Of String, String)
    Dim vRow As DataRow
    For Each vXMLAnnot As XmlNode In vXMLAnnots
        For Each vXMLNode As XmlNode In vXMLAnnot.ChildNodes
            If vXMLNode.OuterXml.Trim.Length > 0 Then
                Dim vAnnotationXMLString As String = vXMLNode.OuterXml
                vRow = AnnotationsTable.NewRow()
                vRow("XmlAnnotation") = vAnnotationXMLString
                AnnotationsTable.Rows.Add(vRow)
            End If
        Next

    Next

    Dim vXMLSb As New StringBuilder("<?xml version=""1.0"" encoding=""utf-8""?>")
    vXMLSb.Append("<xfdf xmlns=""http://ns.adobe.com/xfdf/"" xml:space=""preserve"">")
    vXMLSb.Append("<annots>")
    For Each vDRow As DataRow In AnnotationsTable.Rows

        vXMLSb.Append(vDRow("XmlAnnotation"))
    Next
    vXMLSb.Append("</annots></xfdf>")


    Dim vXMLBytes As Byte() = Encoding.UTF8.GetBytes(vXMLSb.ToString)

    Dim vXMLStream = New MemoryStream(vXMLBytes)
    Dim AnnotationEditor2 = New PdfAnnotationEditor()
    AnnotationEditor2.BindPdf("c:/temp/test.pdf")
    AnnotationEditor2.ImportAnnotationFromXfdf(vXMLStream, gAnnoType)
    vXMLStream.Flush()

    AnnotationEditor2.Save("c:/temp/output.pdf")
    annotationEditor.Close()
    Console.WriteLine("Done")

Private Sub InitializeAnnotationsTable()
AnnotationsTable = New DataTable
AnnotationsTable.Columns.Add(New DataColumn(“XmlAnnotation”, System.Type.GetType(“System.String”)))
Dim vColumn As New DataColumn(“AnnotationText”, System.Type.GetType(“System.String”))
vColumn.AllowDBNull = True
AnnotationsTable.Columns.Add(vColumn)
vColumn = New DataColumn(“IsTextMarkup”, System.Type.GetType(“System.Boolean”))
vColumn.DefaultValue = 0
AnnotationsTable.Columns.Add(vColumn)
AnnotationsTable.Columns.Add(New DataColumn(“AnnotationKey”, System.Type.GetType(“System.String”)))
End Sub
'---------------------------------------------------

test.pdf (260.0 KB)

@modestas

Thanks for contacting support.

We are testing the scenario in our environment and will get back to you shortly. Please be patient.

@modestas

Thanks for your patience.

We have tested the scenario in our environment by executing your code snippet, while using Aspose.Pdf for .NET 17.9 and were able to notice the same issue in the generated output, which you have mentioned. However we have logged an issue as PDFNET-43461 in our issue tracking system. We will further look into the details of the logged issue and keep you updated with the status of its resolution. Please be patient and spare us little time.

We are sorry for the inconvenience.

Hello,

Thank you for checking this. Will look forward for updates / fixes to this problem. Now created a workaround, just increasing width of the text box:

Private Function IncreaseRectWidth(pXmlNode As XmlNode) As XmlNode
        If pXmlNode.Attributes().GetNamedItem("subject").Value = "Typewritten Text" Then
            Dim vXmlNode As XmlNode = pXmlNode.Attributes.GetNamedItem("rect")
            If vXmlNode IsNot Nothing Then
                Dim vSize = pXmlNode.Attributes.GetNamedItem("rect").Value.Split(",")
                vSize(2) = CStr(CInt(vSize(2)) + 10)
                vXmlNode.Value = String.Join(",", vSize)
                pXmlNode.Attributes().SetNamedItem(vXmlNode)
            
            End If

        End If

        Return pXmlNode
    End Function

@modestas

Thanks for acknowledging us.

It is good to know that you have implemented a workaround for now, to resolve your issue and it is highly appreciated that you have shared that with us. It will really help others, facing the similar issue, and as soon as we have some certain updates regarding resolution of the logged issue, we will let you know. Please spare us little time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan