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

Free Support Forum - aspose.com

Replacing text in existing document - file size problem


Have another issue. I need to replace text in existing pdf document. Did that with code:

public void Change_Text()
string stampFile = @“TestData\StampOverlays\stamp.pdf”;
Document doc = new Document(stampFile);

TextFragmentAbsorber textFragmentAbsorber
= new TextFragmentAbsorber(“XXX”);
TextFragmentCollection fragments
= textFragmentAbsorber.TextFragments;
if (fragments != null && fragments.Count > 0)
fragments[1].Text = “Replaced”;

After such operation file size grows from 14 kB to 500kB. Unfortunately document will be used as page stamp in large document and stamp will have different content on each page.

Is there any other way to accomplish same thing without changing file size that much?

I’ve included example stamp file. test done with Aspose.Pdf 6.5

Hi Jacek,

Thank you for sharing the template PDF document and sample code.

I have tested the scenario and able to notice the same problem. For the sake of correction, I have logged this problem as PDFNEWNET-33100 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction.

We apologize for your inconvenience.

Thanks & Regards,

The issues you have found earlier (filed as PDFNEWNET-33100) have been fixed in Aspose.Pdf for .NET 9.8.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.