Hi,
If I have a word document with Form Fields, then how can I convert the document to PDF document with PDF Form Fields. Currently if I do doc.Save() with target file extension as PDF, it just converts the word to PDF as a flattern form, doesn’t showing the PDF Form fields. Can you give some help documentation and your taughts how to do this?
Sample Input Word Document:
Word Doc Form Fields.docx (20.4 KB)
Sample Output PDF Document:
PDF Doc Form Fields.pdf (12.1 KB)
Output PDF document is an just referrence I gave here to see how PDF Form Fields looks like.
@srinudhulipalla
To convert a Word document with form fields into a PDF document that retains those fields as editable PDF form fields, you can use the PdfSaveOptions
class in Aspose.Words. Specifically, you need to set the PreserveFormFields
property to true
when saving the document as a PDF.
Here’s a simple example of how to achieve this in C#:
using Aspose.Words;
using Aspose.Words.Saving;
class Program
{
static void Main()
{
// Load the Word document
Document doc = new Document("path/to/your/WordDocWithFormFields.docx");
// Create PdfSaveOptions and set PreserveFormFields to true
PdfSaveOptions saveOptions = new PdfSaveOptions
{
PreserveFormFields = true
};
// Save the document as a PDF
doc.Save("path/to/your/OutputPDFWithFormFields.pdf", saveOptions);
}
}
Important Notes:
- Ensure that your Word document contains form fields that are compatible with PDF form fields. The PDF format has a limited number of editable form types compared to Word.
- If your document contains content controls, you may need to convert them into form fields first, as content controls do not directly translate to editable fields in PDF.
For more detailed information on converting documents and using PdfSaveOptions
, you can refer to the official documentation on converting Word to PDF and specifying rendering options when converting to PDF.
If you have any further questions or need additional assistance, feel free to ask!
Ok, thank you. But if I have the date calendar control in word it is preserving as a PDF Form Field after conversion. Is there any workarround for the same?
@srinudhulipalla No, unfortunately, there is no workaround for this. If possible, could you please attach your problematic input document here for our reference?
Here is the word document which I tried to convert to PDF form by using the PreserveFormFields = true; , but the output document is not having the date field.
Input Word Document:
Word Doc Form Fields.docx (20.6 KB)
Wrongly converted PDF document (Date form field is missing):
Word Doc Form Fields.pdf (56.9 KB)
Any suggestions to acheive this are welcome!
@srinudhulipalla
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-28237
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.