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

Free Support Forum - aspose.com

Converting Word document to pdf

is there a way to flatten pdf document in code while doing this process?.

I am using the licensed version of Aspose.word. I am trying to fill data in word document and saving it as pdf document. but i could not able to flatten the output pdf document. is there a way to acomplish this?.

Hi there,

Thanks for your inquiry. Please note that Aspose.Words
mimics the same behavior as MS Word do. This means that if you convert
your document to Pdf by using MS Word, you will get the same output.

PdfSaveOptions.PreserveFormFields property specifies whether to preserve Microsoft Word form fields as form fields in PDF or convert them to text. Default is false.

Please use the value of PdfSaveOptions.PreserveFormFields property as false in your code. Following code example shows how to save a document to the PDF format using the Save method and the PdfSaveOptions class.

If you still face problem, please share your input document along with code here for testing. I will investigate the issue on my side and provide you more information.

// Open the document
Document doc = new Document(MyDir + "Rendering.doc");
// Option 1: Save document to file in the PDF format with default options
doc.Save(MyDir + "Rendering.PdfDefaultOptions Out.pdf");
// Option 2: Save the document to stream in the PDF format with default options
MemoryStream stream = new MemoryStream();
doc.Save(stream, SaveFormat.Pdf);
// Rewind the stream position back to the beginning, ready for use
stream.Seek(0, SeekOrigin.Begin);
// Option 3: Save document to the PDF format with specified options
// Render the first page only and preserve form fields as usable controls and not as plain text
PdfSaveOptions pdfOptions = new PdfSaveOptions();
pdfOptions.PageIndex = 0;
pdfOptions.PageCount = 1;
pdfOptions.PreserveFormFields = true;
doc.Save(MyDir + "Rendering.PdfCustomOptions Out.pdf", pdfOptions);

A post was split to a new topic: Convert DOCX to PDF issue for form fields