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


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


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

Received Result

image.png (23.2 KB)

Expected Result

image.png (32.6 KB)

Test File

test.zip (239.7 KB)


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.