Free Support Forum - aspose.com

Minor bug in PDF Generation

I've just encountered a small bug in the PDF Generation, there's a simple workaround, but hopefully the Devs can fix it in the next release.

Before saving to PDF, I'm doing a search and replace. When saving as a PDF, the last replace command does not work, but when saving as DOC the changes are made.

Code Below: ({NUMPAGES} does get get replaced.

this.MasterDoc.Range.Replace("{NUMPAGES}", npagecount.ToString(), true, false);
this.MasterDoc.SaveToPdf(coutput);

Code Below: (Works fine)

this.MasterDoc.Range.Replace("{NUMPAGES}", npagecount.ToString(), true, false);
this.MasterDoc.Save(System.IO.Path.GetTempPath() + "fixed_report.doc");
Document docFinal = new Document(System.IO.Path.GetTempPath() + "fixed_report.doc");
docFinal.SaveToPdf(coutput);

So it looks like, saving to DOC first and re-opening and saving as PDF is an interim solution.

NB. The replacement is in a footer.

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Could you please attach your input document here for testing? I will check the problem on my side and provide you more information.

Best regards,