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

Free Support Forum - aspose.com

How to disable DTD parsing during Word to PDF conversion using .NET

Hi Team,

Is there any way to disable the DTD parsing during the file conversion from word to pdf?



To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please attach the output Word/PDF file that shows the undesired behavior.
  • Please attach the expected output Word/PDF file that shows the desired behavior.
  • Please create a standalone console application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hi @tahir.manzoor,

Thanks for your response.

I am trying to achieve the file conversion while ignoring the DTD parsing. I have a web application and if the end user uploads any OXML document it converts into pdf and saves it in the file storage. My requirement is to ignore the complete Doctype section of the XML because they can be injected with XXE payloads, so during the file conversion the Doctype shouldn’t be parsed and rest of the document should be converted as it is. How can this be achieved during the conversion?

Please find the code at this https://1drv.ms/u/s!AqoY6RHGQ5rOojRkexWUCI6Wod_J?e=9dWcYA

I have attached the code in the zip format in the above link for your reference. In the bin folder, you will find a file with the name Dummy_WithDTD.docx which is injected with a sample DTD syntax. The conversion works fine and the output is generated as expected but the DTD is getting parsed during the conversion.

Let me know if any more details are required.



We have converted the shared Word documents to PDF and have not found any issue with output PDF. We have not found any DTD syntax in Dummy_WithDTD.docx. Could you please share how are you checking the DTD in Word document? Please also share the screenshot of it. Thanks for your cooperation.