Pdf rendition is matching office rendition but not matching adobe addon

Hi,
We are using the latest Aspose Words to render a document to Pdf rendition.
Pdf generated is exactly same as office rendition. But customer is using an extra addon in office i.e. Acrobat PDFMaker.
Customer is able to create the proper rendition with Acrobat PDFMaker.

It gives them this option to save as Acrobat Pdf
image-2022-04-21-14-29-09-131.png (25.1 KB)

Difference between the office with Acrobat PDFMaker rendition and aspose rendition.

The PDF rendition of the input document has one line that does not match the original Word document.
Please see rendition file, on page 51, item 2.26

  • Original document
    Amount of acceptable product
    (Step ‎2.21 “C”)

  • PDF Rendition
    Amount of acceptable product
    (Step 0 “C”)

Ask from aspose
Is there any way we can render a PDF similar to what customer is expecting.
Report.zip (2.3 MB)

Regards,
Ankur Vashishtha

@rnara The problem occurs because both MS Word and Aspose.Words update REF fields before saving to PDF. You can disable field updating in Aspose.Words to get the expected result:

Document doc = new Document(@"C:\Temp\in.docx");
PdfSaveOptions opt = new PdfSaveOptions();
opt.UpdateFields = false;
doc.Save(@"C:\Temp\out.pdf", opt);

Alternatively, you can unlink or lock REF fields in your document to prevent updating them:

Document doc = new Document(@"C:\Temp\in.docx");
foreach (Field f in doc.Range.Fields)
{
    if (f.Start.FieldType == FieldType.FieldRef)
        f.IsLocked = true;
}
doc.Save(@"C:\Temp\out.pdf");

Hi,
Is this because of an OLE?
Can you please provide more details on the analysis.

Regards,
Ankur Vashishtha

@rnara No, there are no OLE objects in your document. On the 51st page of your document there is a REF field { REF _Ref530570301 \r \h \* MERGEFORMAT }:

If you update this REF field, its value will be zero, just like in the PDF produced by Aspose.Words or MS Word, because by default they update fields upon rendering it to PDF.
You can right click on the field and select “Toggle Field Codes” to see field code:

Thanks a lot. One more query.
Then why by default, if you open in office, it shows 2.21 instead of 0?

Regards,
Ankur Vashishtha

@rnara

Because while opening the document MS Word does not update REF fields, the same as Aspose.Words. The field is updated upon saving to PDF.

Hi Alexy,
My question is regarding the value it picks, in this case 0 when it doesn’t update the field?
So you mean the REF Field default value is 0?
Is there any such concept?
Sorry for asking so many queries but I have to explain the same to customer.

How can the customer fix this issue? Is this REF thing internal to Office or this is added by use while creating a document?

Regards,
Ankur Vashishtha

@rnara The value of REF field is calculated according to the switches specified in the field. You can learn more about REF field code and switches in MS Word documentation:
https://support.microsoft.com/en-us/office/field-codes-ref-field-b2531c23-05d6-4e3b-b54f-aee24447ceb2
In your case you have the following Field code: { REF _Ref530570301 \r \h \* MERGEFORMAT }.
_Ref530570301 is name of bookmark the REF field refers to.
\r - Inserts the entire paragraph number of the bookmarked paragraph in relative context — or relative to its position in the numbering scheme — without trailing periods
\h - Creates a hyperlink to the bookmarked paragraph.

Since the referenced paragraph does not have number (means ordered list number), zero value is inserted when \r switch is used.

thanks a lot for the detailed explanation. You may close this task

1 Like