Content Controls not Preserved during Converting XML to PDF


As I see the issue logged it says “Content Controls not Preserved during Converting XML to PDF”.
Is aspose provide way to preserve content controls in PDF also?

Content missing in the output PDF while converting WodXml/OOXML to PDF


Thanks for your inquiry. Please ZIP and upload your input Word document and Aspose.Words generated PDF file showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.


I am asking is aspose provide any way by which we can see content controls of the word document in the converted PDF?

As par our system, we have a word document with content controls. And we will convert that word document into PDF for review process. And the bu annotating PDF an authorised person will review the document. That annotations we need to match to content controls.

But the challenge is Word document works on ranges and PDF works on co-ordinates. So if Aspose is giving us any capability to preserve content controls in PDF document also we can easily get that to which content controls the annotation belongs.



Please set PdfSaveOptions.PreserveFormFields to true when saving to PDF to save the StructuredDocumentTag nodes (Content Controls) as AcroFrom fields in PDF.

Document doc = new Document("D:\\Temp\\input.docx");

PdfSaveOptions opts = new PdfSaveOptions();
opts.PreserveFormFields = true;

doc.Save("D:\\Temp\\18.7.pdf", opts);

You can also use StructuredDocumentTag.Id to specify the AcroForm name. Hope, this helps.

If you are looking for something else, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • Aspose.Words generated output PDF file showing the undesired behavior
  • Your expected PDF file showing the correct output. Please create this document by using MS Word.

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


Thanks for quick response.
There are some more queries,
Can we block the content control for editing in PDF? No content control should be editable.
And how we can provide names for these forms?

There are some issues or expected behaviors in the converting content controls.

  1. Even if content in content control is more than one line, then also converted PDF shows that in one line. (SimpleTextControl SDT in provided zip file)
  2. For block level SDTs, it is not cnverting the content control to AcroFrom field. It is similar to WORDSNET-16962. (BlockLevelContentControl in provided zip file) (63.9 KB)



Please try using the following code:

Document doc = new Document("D:\\Temp\\UserFiles\\SimpleTestDoc2.docx");

int i = 0;
foreach (StructuredDocumentTag sdt in doc.GetChildNodes(NodeType.StructuredDocumentTag, true))
    sdt.Title = "title_" + i;
    // here you can set anymore properties of content controls

PdfSaveOptions opts = new PdfSaveOptions();
opts.PreserveFormFields = true;

PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);
encryptionDetails.Permissions = PdfPermissions.DisallowAll;
encryptionDetails.Permissions = PdfPermissions.ContentCopy | PdfPermissions.ContentCopyForAccessibility | PdfPermissions.DocumentAssembly |
                                PdfPermissions.HighResolutionPrinting |

opts.EncryptionDetails = encryptionDetails;

doc.Save("D:\\Temp\\UserFiles\\18.7.pdf", opts);

To address this problem, we have logged the following issue:
WORDSNET-17180: Multi-Line Content Control renders as a Single Line control in PDF

To address this problem, we have logged the following issue:
WORDSNET-17181: Block level SDT not converting to Editable AcroFrom field

Your thread has also been linked to these issues and you will be notified via this thread as soon as these issues are resolved. Sorry for the inconvenience.


Above shared code is not setting the Name to the form field in PDF.
Can you please verify?
I have checked SDT’s title and Properties (Name, Partial Name, Full Name) of form field of PDF are not matching.



Please share your expected PDF document containing the form field control with Name attribute set. Please also share a screenshot showing the Name attribute that you want to set in PDF. Thanks for your cooperation.