How to handle Error unknown document property name in word Document

Hi Aspose Group,

We have a requirement where we receive Word documents which has custom field in document like:
{DOCPROPERTY "Form Title" \* MERGEFORMAT}
{PAGE} of {NUMOFPAGES}

And we want to convert this document into tiff and also to PDF. We will receive documents that may not have such custom fields.

We want to make sure the converted PDF/TIFF file should have the value of these fields instead of showing “Error unknown document property”

@hemassridhar You can unlink or lock DOCPROPERTY before converting document to PDF/TIFF. For example see the following code:

Document doc = new Document("C:\\Temp\\in.docx");
for (Field f : doc.getRange().getFields())
{
    if (f.getType() == FieldType.FIELD_DOC_PROPERTY)
    {
        // Lock the field. The locked field will not be updated upon updating fields in the document.
        f.isLocked(true);
        // Instead of locking field, it can be unlinked - replaced with it's current displayed text
        //f.unlink();
    }
}
doc.save("C:\\Temp\\out.pdf");