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

Free Support Forum - aspose.com

Find and Replace text inside PDF using Aspose.PDF for Java - Text is overlapped

I am using Aspose-pdf (19.12) licensed version. When I replace a content in a pdf file, its getting overlapped.
Implemented code:
// Initialize License Instance
com.aspose.pdf.License license = new com.aspose.pdf.License();
// Call setLicense method to set license
license.setLicense(ReplaceTextAspose.class.getResourceAsStream("/Aspose.Total.Java.lic"));
final FileInputStream fis = new FileInputStream(filePath);
Document pdfDocument = new Document(fis);
textFragmentAbsorber = new TextFragmentAbsorber(“Test”, new TextSearchOptions(true));
pdfDocument.getPages().accept(textFragmentAbsorber);

// Get the extracted text fragments into collection
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments();
pdfDocument.getPages().accept(textFragmentAbsorber);
// Get the extracted text fragments into collection
for (TextFragment textFragment : (Iterable) textFragmentCollection) {
//Update text and other properties
textFragment.setText(“Tested”);
}

@Amaran

Could you please share a sample PDF with us. We will test the scenario in our environment and address it accordingly.

After_replaced_pdf_sample.pdf (5.3 MB)
source_pdf_sample.pdf (5.3 MB)

Page-1 having text overlapping, after text replaced in it.

@Amaran

We have managed to replicate the issue in our environment while using Aspose.PDF for Java 20.2. We have logged it as PDFJAVA-39220 in our issue tracking system for further investigation and will keep you posted with its rectification status. Please be patient and spare us little time.

We are sorry for the inconvenience.

Hi Asad,

Can you please give the priority for this issue?
My Client is waiting for this solution.

Thanks,
Amaran.

@Amaran

We are afraid that earlier-logged ticket is not yet resolved. As it was logged under normal support, it will be resolved on first come first serve basis. We have recorded your concerns and will surely consider them during issue analysis. We will inform you as soon as we have some updates about it resolution. Please have patience and give us some time.

We are sorry for the inconvenience.