Free Support Forum - aspose.com

Word to pdf repeating same number 3 times

We have document create in word, with table, a particular value is repeating continuously in a converted pdf

@nsikkandhar,

Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.

PaySlip_Tim Roger_April 2018.zip (74.9 KB)
string strPDFname;
Aspose.Words.Document objDoc;
strPDFname = System.IO.Path.GetDirectoryName(destinationFile) + “\” + System.IO.Path.GetFileNameWithoutExtension(destinationFile) + “.pdf”;
objDoc = new Aspose.Words.Document(destinationFile);
objDoc.Save(strPDFname, Aspose.Words.SaveFormat.Pdf);

@nsikkandhar,

Thanks for sharing the document. Your document contains the REF fields. Please check the attached image. Ref field.png (36.4 KB)

When you save the document to PDF, this field is updated. MS Word does the same. You can update this field using MS Word to see the output of this field. Please use PdfSaveOptions.UpdateFields property as shown below to get the desired output. This property gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.

Document doc = new Document(MyDir + "PaySlip_Tim Roger_April 2018.docx");
PdfSaveOptions options = new PdfSaveOptions();
options.UpdateFields = false;
doc.Save(MyDir + "18.4.pdf", options);