Reference is shown in the converted pdf

Run the following code to convert docx to pdf, reference is shown in pdf.
Attached are original docx file and converted pdf file.

final PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setWarningCallback(new WarningCallback());

            File converted = PathUtils.createTempFile("SB_figure_test-Converted.pdf");

            try {
                Document doc = new Document("SB_figure_test.docx");
                stripTrackChangesData(doc);
                doc.save(converted.getAbsolutePath(), saveOptions);
            } catch (FileCorruptedException e) {
                LOG.warn(WARNING_ASPOSE_FILE_CORRUPTED, e);
         
            } catch (Exception e) {<a class="attachment" href="/uploads/default/8554">reference_shown.zip</a> (463.2 KB)

                throw e;
            }

How could get rid of reference in the pdf? Thanks!reference_shown.zip (463.2 KB)

@ruhongcai

Thanks for your inquiry. Please convert Ref Field to static text before PDF conversion, it will resolve the issue. Please check following documentation link for details, it will resolve the issue. SB_figure_test_Aw1710.pdf (266.0 KB)

Replace Fields with Static Text

Document document = new Document("SB_figure_test.docx");
FieldsHelper.ConvertFieldsToStaticText(document, FieldType.FieldRef);
document.Save("SB_figure_test_Aw1710.pdf");

Hi,

Thanks for your advice and it helps for fixing the problem by the following revised java code


FieldsHelper.convertFieldsToStaticText(doc, FieldType.FIELD_REF);

Need to apply FieldsHelper from

Many thanks!

Ruhong

@ruhongcai,

It is great you were able to find what you were looking for. Please let us know any time you have any further queries.