PdfContentEditor not replacing text

Hello,

I’m evaluating the PDF Kit for Java and am trying to replace text. The output file is generating fine with no errors but the PDF text isn’t being replaced. Here is my sample code and the source PDF for reference.

Let me know if there’s something I’m missing.

Thanks!

Brandon Staton

License license = new License() ;
FileInputStream fis = new FileInputStream( “C:\aspose\Aspose.Pdf.Kit.lic” ) ;
license.setLicense( fis ) ;
File inputFile = new File(“C:\temppdf\TestPDF.pdf”);
File outputFile = new File(“C:\temppdf\TestPDF-output.pdf”);
ByteArrayInputStream bais = null;
ByteArrayOutputStream baos = null;

PdfContentEditor editor = new PdfContentEditor();
byte[] baPdfFile = FileUtils.readFileToByteArray(inputFile);
bais = new ByteArrayInputStream(baPdfFile);
editor.bindPdf(bais);
editor.replaceText( “@FirstName@”, “Brandon” ) ;
editor.replaceText( “@LastName@”, “Staton” ) ;
baos = new ByteArrayOutputStream();
editor.save(baos);
baPdfFile = baos.toByteArray();
bais.close();
baos.close();

FileUtils.writeByteArrayToFile(outputFile, baPdfFile);

Hi Brandon,

Thank you very much for considering Aspose.

I have reproduced this issue at my end and logged it as PDFKITJAVA-13195 in our issue tracking system. Our team will be looking into the matter and you’ll be updated via this forum thread once the issue is resolved.

We’re sorry for the inconvenience.
Regards,

Hi Brandon,

I would like to inform you that the fix for this will be available in our next monthly release, due at the end of February 2010. However, I’ll consult our development team to see if we would be able to provide a hotfix earlier.

We’re sorry for the inconvenience.
Regards,

Hi Brandon,

Please try the attached hot fix for this issue. If you still find any issues, please do let us know.

Regards,

The issues you have found earlier (filed as 13195) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.