Issue with merging RTF documents having Document variables

Hi,

We have an issue with merging multiple documents into a single document when the documents have document variables in them. The value of the document variables in the header of one document is repeating for all the documents. We are trying to merge the documents and convert the merged document to PDF. Please see attached sample RTF documents and the merged PDF file. Please also find attached the code that we are using for this purpose. Please advise on how we can correct this.

Thanks,

-Eswar.

Hi Eswar,

Thanks for your inquiry. Your input documents contain the same variable names e.g. vLastName and vPatientNumber. When you merge the documents and update the fields, you will get the same value for all variables in output document.

In your case, we suggest you please do not call Document.updateFields method before saving the document to Pdf. We have tested the scenario using latest version of Aspose.Words for Java 16.2.0 and have not found the shared issue. Please check the attached output document.

Moreover, you can use PdfSaveOptions.UpdateFields property to get or set a value determining if fields should be updated before saving the document to Pdf. Default value for this property is true. This property is available in Aspose.Words for Java 16.2.0.

PdfSaveOptions options = new PdfSaveOptions();
options.setUpdateFields(false);
printDocument.save(MyDir + "Out.pdf");

Hi Tahir,
Thanks for looking into this. We tried with the new version of ASPOSE and the issue is resolved. Looks like it is with the older version.

Thanks,
-Eswar.

Hi Eswar,

Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.