Issue: PDF Conversion from Word Template (.dotx) Results in e_document_conversion_incomplete

Hi everyone,

I am working on a task to generate a PDF from a Word template (.dotx). The workflow is:

  1. Retrieve the .dotx template from SQL Server (stored as binary).
  2. Populate the template using OpenXML Document with data from the database.
  3. Attempt to convert the filled document to PDF using PDFTron.
    However, the conversion process returns the status e_document_conversion_incomplete.
    Code Snippet:
using (var pdfdoc = new PDFDoc())
{
    var options = new pdftron.PDF.ConversionOptions();
    options.SetFileExtension(".dotx");

    wordStream.Position = 0;
    int length = checked((int)wordStream.Length);
    byte[] buffer = new byte[length];
    wordStream.Read(buffer, 0, length);

    MemoryFilter inData = new(length, false);
    var inDataBuffer = inData.GetBuffer();
    Buffer.BlockCopy(buffer, 0, inDataBuffer, 0, length);
    inData.SetAsInputFilter();

    var conversion = pdftron.PDF.Convert.StreamingPDFConversion(pdfdoc, inData, options);

    if (conversion.GetConversionStatus() != DocumentConversionResult.e_document_conversion_success)
    {
        throw new InvalidOperationException($"PDFTron conversion failed: {conversion.GetErrorString()}");
    }
}

What I have Checked:
• The input stream contains a valid .dotx file (header is correct, opens in Word).
• The file extension is set to .dotx in the conversion options.
• The PDFTron Office Conversion module is licensed and initialized.
Questions:
• Has anyone successfully converted a .dotx to PDF using PDFTron?
• Are there additional requirements or limitations for .dotx files?
• Is there a recommended way to prepare the template before conversion?
• What are common causes for e_document_conversion_incomplete in this scenario?

Any insights or suggestions would be greatly appreciated!
Thank you.

1 Like

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems like you’re encountering an issue with converting a .dotx file to PDF using Apryse (formerly PDFTron) and receiving an e_document_conversion_incomplete status. This typically indicates that the conversion process didn’t complete successfully, possibly due to issues with the document content, unsupported features, or missing dependencies.

Some things you can try:

  • Ensure that the .dotx file is fully populated and doesn’t contain any unsupported features that might cause conversion issues.

  • Verify that all necessary resources and dependencies for the conversion are correctly set up, such as Microsoft Office interop if required.

  • Check the conversion logs (if available) for any specific error messages that might provide more insight into the issue.

  • Consider converting the .dotx file to a .docx format first, as .docx is more commonly supported and might yield better results.

  • Ensure that your Apryse SDK is up-to-date and includes all necessary modules for Office conversion.




Here are some resources that might help you:



Hopefully, this helps you solve your problem while you wait for a human to get back to you.

1 Like

Hello,

You typically would use a .dotx file with the template generation part of our SDK. This would allow you to use JSON data and create a filled PDF from the two.

Would using the approach demonstrated in our documentation here work for you?

When doing the conversion using your code are you able to reproduce your issue if you convert the file from DOCX? Do you still run into the same exception when doing so?

1 Like