We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ERROR! UNKNOWN DOCUMENT PROPERTY NAME (Converting RTF to PDF)

I am not sure if this is a problem in the Words product or the PDF product so unfortunately I’m double posting this…

When I look at the PDF output I am seeing the phrase “ERROR! UNKNOWN DOCUMENT PROPERTY NAME” embedded in the PDF.

Is there any way that I can suppress this from being added to the PDF?

Is there any way that I can hook up to an event or a method that I can supply a callback to that will return the errors that it is encountering so that I may deal with them??

Thanks!

I am not sure if this is a problem in the Words product or the PDF product so unfortunately I’m double posting this…

When I look at the PDF output I am seeing the phrase “ERROR! UNKNOWN DOCUMENT PROPERTY NAME” embedded in the PDF.

Is there any way that I can suppress this from being added to the PDF?

Is there any way that I can hook up to an event or a method that I can supply a callback to that will return the errors that it is encountering so that I may deal with them??

Thanks!

Hi there,

Thanks for your inquiry. Please note the subjected feature, RTF to PDF, relates to Aspose.Words. So I am moving your request to related forum. My colleagues will guide you appropriately.

Moreover, please share your sample input/output document, it will help to investigate the issue.

We are sorry for the inconvenience caused.

Best Regards,

Hi there,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.

  • Please attach your input Word documents.
  • Please

create a standalone/runnable simple application (for example a Console
Application Project
) that demonstrates the code (Aspose.Words code) you used to generate
your output document

  • Please attach the output Pdf file that shows the undesired behavior.

Unfortunately,
it is difficult to say what the problem is without the Document(s) and
simplified application. We need your Document(s) and simple project to
reproduce the problem. As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

Good Morning Tahir,

Unfortunately I am unable to provide an isolated case where you can debug the error. I suppose what I am asking is there an event I can wire up that will report conversion errors during the save method or some overloaded version of the save method that will report conversion errors. Since the documents being distributed are healthcare in nature I dont want to distribute them with error messages on the document.

Thanks

Hi Mike,

Thanks for your inquiry. I suggest you
please implement IWarningCallback Interface. Implement this interface if
you want to have your own custom method called to capture loss of
fidelity warnings that can occur during document loading or saving.
Please check the following code example for your kind reference.

Document doc = new Document(MyDir + "in.docx");
PdfSaveOptions options = new PdfSaveOptions();
options.WarningCallback = new HandleDocumentWarnings();
doc.Save(MyDir + "Out.pdf", options);
public class HandleDocumentWarnings : IWarningCallback
{
    public void Warning(WarningInfo info)
    {
        Console.WriteLine(info.Description);
    }
}

It would be great if you please share some detail about your scenario. It is difficult to say what the problem is without the document. We need your document to reproduce the problem. I will investigate the issue on my side and provide you more information.

Good Afternoon,

I have been able to produce a simple example of the problem I’m having… In the ConsoleApplication I’m attaching you’ll see that when I load the RTF and save it as a PDF, “ERROR! UNKNOWN DOCUMENT PROPERTY NAME” is in the PDF. Im hoping you are able to help me determine what is causing this to appear in the document.

Hi Mike,

Thanks for sharing the detail.

Please note that Aspose.Words mimics the same behavior as MS Word does. If you convert your document to Pdf using MS Word, you will get the same output. You are facing the shared issue due to invalid document property COPYTEXT. Please update the DocProperty field using MS Word, you will get the same output. See the attached image for detail. Please read about DocProperty field from here:
https://support.microsoft.com/en-us/office/list-of-field-codes-in-word-1ad6d91a-55a7-4a8d-b535-cf7888659a51

Hello! Great! Thanks for the information! I’m glad this is a solvable issue! I have a few follow up questions though.

  1. How did you diagnose the problem? Is there a way that I can programmatically log this issue as messages come in??

  2. Can I programmatically update or remove this invalid document property? These messages will be coming from an enterprise application and most likely unable to be modified before they are sent to me.

Thanks for your attention to this matter!

Hi Mike,

Thanks for your inquiry. Please use Document.UpdateFields method to update the values of fields in the whole document. When you open, modify and then save a document, Aspose.Words does not update fields automatically, it keeps them intact. Therefore, you would usually want to call this method before saving if you have modified the document programmatically and want to make sure the proper (calculated) field values appear in the saved document.

Please use following code example to achieve your requirements. Hope this helps you.

Document doc = new Document(MyDir + "input.rtf");
doc.UpdateFields();
foreach (Field field in doc.Range.Fields)
{
    if (field.Type == FieldType.FieldDocProperty)
    {
        if (field.Result.ToString().StartsWith("Error"))
        {
            field.Remove();
        }
    }
}
doc.Save(MyDir + "Out.docx");

Great! Thanks for the input! My last question on this thread was how did you determine that the COPYTEXT document property was the one that the error message was referring to? It could have been about any of the document properties…

Hi Mike,

Thanks
for your inquiry. You can insert DocProperty field into Word document from Insert Tab->Quick Parts->Field. You can find the list of Doc Properties under ‘Document and information’ category. Please see the attached image for detail. There is no COPYTEXT property for DocProperty field.

Please note that Aspose.Words mimics the same behavior as MS Word does. If you update the fields via MS Word or Aspose.Words, you will get the same output. Please open your document in MS Word and update the field, you will get the same error message.

Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.