Preserve Form Field - C#

I’m not able to get the preserve form fields to work as expected. Attached is a sample project and in/out files

PreserveFormFieldTest.zip (65.1 KB)

@miles-1,

Thanks for your inquiry. Please note that PdfSaveOptions.PreserveFormFields property is used to preserve Microsoft Word form fields as form fields in PDF. Your document contains the content control (StructuredDocumentTag).

Hi Tahir,

I’m not understanding what you’re saying about the StructuredDocumentTag. Could you either:

  1. Explain to me how to modify my DOCX to work
  2. Explain how I can modify the usage of the Aspose library to handle this

@miles-1,

Thanks for your inquiry. The FormField class represents legacy form controls. You can insert legacy form using MS Word from developer tab. See the attached image (Legacy Forms.png) for detail. You can get form fields using Range.FormFields property.

Your document does not contains form fields. The image of contents controls is also attached (content control.png (29.5 KB)). We suggest you please read following documentation articles to work with content controls and form fields. Hope this helps you.
Working with Content Control
Working with Form Fields

Hi Tahir,

Again, I’m not seeing how this is going to help me preserve fillable fields when saving a DOCX to a PDF. In the original attached file (Test input.docx), the file contained a Textbox, Richtextbox and Checkbox from the Developer tab in Word. When I attempt to read that file and save it as a PDF, these are not fillable. I’m not sure how a form field will be able to help (I’ve tried adding going to Insert -> Quick Parts -> Field -> Title -> Title case but nothing gets inserted in to the DOCX).

Also, I’m not sure why you included the image of the content control (aren’t I not supposed to use these controls based on your earlier message?)

Could you modify the DOCX and add some type of field to the document so I can see what you added and test it locally?

@miles-1,

Thanks for your inquiry. To use PdfSaveOptions.PreserveFormFields property, you need to use legacy form control. Please check the attached Word document. Test input.zip (17.7 KB). We have added text form field and checkbox in the document.

Thank you, that solved the issue. Please mark this as closed.

A post was merged into an existing topic: Style rendering issue with aspose rich text content control