Hey Guys,
I have a project that requires that I read an existing PDF document, and replace certain values within the text. When I am done the new document has to look like the old with the values replaced (same font etc).
Can PDF.Kit do this? Any insight on best path to take to get this accomplished with PDF Kit?
Thanks in Advance,
Terance Emory
Hi,
Thank you for considering Aspose.
You can change the certain values in the PDF Document if they are meta information or some Form Field Value using Aspose.Pdf.Kit. Please have a look at both :
If you need more help, please do let us know.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html
Dear Emory,
I think I misunderstood the requirements. It is possible to change the text. Please have a look at:
Hope it will help.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
Adeel,
Thanks for your help on this one, this looks very promising. I tried putting together a proof of concept so I can get approval to go ahead with this, but cant seem to get this code to work based on the example.
My Code:
Aspose.Pdf.Kit.PdfContentEditor editor = new Aspose.Pdf.Kit.PdfContentEditor();
WriteStatus("Loading PDF File");
editor.BindPdf(txtFileName.Text);
WriteStatus("Reading PDF looking for changes");
editor.ReplaceText(txtOldValue.Text, txtNewValue.Text);
WriteStatus("Writing new PDF to disk");
editor.Save("Modified.pdf");
WriteStatus("Process Completed");
When I attempt to run this, it appears to work, only the new file is completely empty of content. If I take out the line (editor.ReplaceText) the new file is corrupt. Is there a step I am missing to make sure the new file has the content of the old file?
Thanks in Advance,
Terance Emory
Hi,
I have checked the code and didn’t get the error that you report. May be there is a problem with the pdf file that you are using. Can you please send us the pdf file so that we can more accurately determine the cause of problem.
Thanks.
Adeel Ahmad
Support Developer
Aspose Changsha Team
http://www.aspose.com/Wiki/default.aspx/Aspose.Corporate/ContactChangsha.html