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

Free Support Forum - aspose.com

Insert line break to TextFragment not woking for Aspose.PDF

Description

I updated a string with line break via TextFragment.Text, but the output file ignored line break.

Code

    var doc = new Aspose.Pdf.Document(@"C:\Users\XCL\Desktop\test\1.pdf");
    var textFragmentAbsorber = new TextFragmentAbsorber("1");
    doc.Pages.Accept(textFragmentAbsorber);
    TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
    foreach (TextFragment textFragment in textFragmentCollection)
    {
        textFragment.Text = $"1.{Environment.NewLine}";
        //textFragment.Text = "1.\n"; Not working too.
    }
    doc.Save(@"C:\Users\XCL\Desktop\test\1-out.pdf");

Received Result

image.png (23.2 KB)

Expected Result

image.png (32.6 KB)

Test File

test.zip (239.7 KB)

@xucongli1989

We have logged this problem in our issue tracking system as PDFNET-53415. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.