We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

When using Aspose.PDF For NET to add comments, occasionally the comment content will appear garbled

When using Aspose.PDF For NET to add comments, occasionally the comment content will appear garbled;
Code used:

public bool AddPDFAnnotation(string filepath, int pageindex, string Annotation, string dw)

            License license = new License();
            //open document
            Document pdfDocument = new Document(filepath);

            TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(dw);

            PageCollection pages = pdfDocument.Pages;
            // textFragmentAbsorber.TextFragments[0].Rectangle;

            if (textFragmentAbsorber.TextFragments.Count == 0)
                return false;

            //create annotation
            TextAnnotation textAnnotation = new TextAnnotation(pdfDocument.Pages[pageindex], textFragmentAbsorber.TextFragments[1].Rectangle);// new Aspose.Pdf.Rectangle(200, 200, 200, 200));
            textAnnotation.Title = "注释标题";
            textAnnotation.Subject = "注释主题";
            textAnnotation.State = AnnotationState.Accepted;
            textAnnotation.Contents = Annotation; 
            textAnnotation.Open = true;
            textAnnotation.Icon = TextIcon.Key;
            Border border = new Border(textAnnotation);
            border.Width = 5;
            border.Dash = new Dash(1, 1);
            textAnnotation.Border = border;
            textAnnotation.Rect = textFragmentAbsorber.TextFragments[1].Rectangle;// new Aspose.Pdf.Rectangle(200, 100, 100, 100);
            //add annotation in the annotations collection of the page
            ////save output file
            return true;
        catch (Exception ex)
           // Loger.Error(ex, " ");
            return false;

Annotation content:

It is normal for normal Chinese characters to be displayed after inserting comments. Occasionally, there will be garbled characters after Chinese and English letters are mixed. What is the general problem in this situation? How to solve?
Please, thanks!
Annotate garbled effect pictures and PDF files, please refer to the attachment;
img.png (49.9 KB)
66874-2.pdf (111.6 KB)


A ticket with ID PDFNET-50473 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.