Adding Editable PDF Fields with a Word Template

Hello all,
I’m building an ASP.net system to take a load of information, and generate one or more PDFs. To give the end user options to customise the look of the PDFs, I’ve been starting with a Word document where I replace fields with text from the database column of the same name and save to PDF.
Now I’ve got to find some way of specifying in the Word document where I want to position an editable text box in the final PDF. I can’t fathom a way of doing that.
I’ve considered having text like “TB_3_FULL” for example, where the “3” is height of 3 lines (ish) and “FULL” or another number is the length of the text box. Then it’s just a question of inserting the correctly sized text box in place of that text.
Is there a better way? If this is a good way, how do I find the location of the text, or insert a textbox over it?
Cheers,

Mike

Hi,


Thanks for your interest in our API’s.

Your query seems to be related to MS Word file format and therefore I am moving this thread to Aspose.Words product support forum where my fellow workers from respective team will further look into this requirement and will answer accordingly.

Hi,


Thanks for your inquiry. Could you please attach your input and expected Word documents here for our reference. You can create your target document using Microsoft Word. We will investigate your scenario and provide you code to achieve the same using Asopse.Words.

Best regards,

Hi,



Sorry for the delay - been rather busy here.

I’ve attached two files. I’d like to start off with something like the QFN word doc. There would be some marker here - for instance Field3 in this case. The existence of that marker would mean that the PDF generated at the end would have an editable field, like in the supplied PDF…



I suppose the main question is how do I add an editable field in the same location as the “marker” in the PDF…





Hope that explains what I’m trying to achieve.



Cheers,



Mike

Hi Mike,


Thanks for sharing the details.

As per your requirement, you may consider following the steps specified below

  • first converting the DOCX file to PDF format
  • Search particular text string inside PDF and get its locations
  • replace text string with blank characters
  • insert Form field on same location.

For further details, please visit

Hi Mike,


Thanks for your inquiry. Upon setting PdfSaveOptions.PreserveFormFields property to true, the latest version of Aspose.Words can export Microsoft Word form fields (that include text input, drop down and check box controls) as editable Pdf form fields. Please try executing the following code:

Document doc = new Document(MyDir + @"\QFN.docx");

PdfSaveOptions so = new PdfSaveOptions();

so.PreserveFormFields = true;

doc.Save(MyDir + @“out.pdf”, so);


I hope, this helps.

Best regards,

Hello,

Thanks very much for that, it’s helped a great deal for Word to PDF conversions. Next question though, is there something similar for Excel to PDF?

Cheers,

Mike

Hi Mike,

This is supported in Excel to PDF conversion. You do not need to set any option for that. Please check DrawingObjects element in the table at the end of Converting Excel to PDF topic.

Best Regards,

Hi,



Thanks for that. I had already tested a text box. It didn’t automatically become an editable field in the PDF though… Am I missing something else?



Cheers,



Mike

Hi Mike,

This issue has been logged into our issue tracking system as CELLSNET-42664. We will update you as soon as it is resolved. Sorry for the inconvenience.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan