Image is Lost after Call of Document.UpdateFields | DOCX to PDF Conversion using .NET

Hi. Converting a .docx file to PDF after updating fields deletes an image. Details are shown in the image below:

issue.png (36.9 KB)

The code for saving the file after updating is:

            var doc = new Document(sourceDocument);
            doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;
            doc.UpdateFields();
            doc.Save(m_pdfOutput.OutputPath);

The code for saving the file without updating is:

            var doc = new Document(sourceDocument);
            doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;

            var saveOptions = new PdfSaveOptions();
            saveOptions.UpdateFields = false;
            doc.Save(m_pdfOutput.OutputPath, saveOptions);

We would like it so that the image is shown even after updating fields.

I have attached the .docx file, along with three outputs: word > save as PDF output; aspose > update fields output; and aspose > don’t update fields output.

test.zip (466.8 KB)

Thank you for your help.

@ServerSide527

We have tested the scenario and managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-22621. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

1 Like

@ServerSide527

We have closed this issue (WORDSNET-22621) as ‘Not a Bug’. Please note that Aspose.Words mimics the behavior of MS Word. If you update the fields of document using MS Word, you will get the same output.