Remove All Field Codes from Word Document & Convert DOCX to PDF File using Java

Hi,

I want to remove all field codes in word and convert it to pdf file in java

could you please help me.

Thank you.

@velpukondaramesh,

You can remove all fields from Word document and then convert it to PDF format by using following Java code of Aspose.Words API:

Document doc = new Document(new FileInputStream("C:\\temp\\input.docx"));
System.out.println("Total Fields = " + doc.getRange().getFields().getCount());
for (Field field : doc.getRange().getFields())
    field.remove();
System.out.println("Total Fields = " + doc.getRange().getFields().getCount());
doc.save("c:\\temp\\21.4.pdf");