I am using a node.js app that generates FDF content from my data. How can I merge this into an existing PDF form?

I am using NodeJS and NPM module fdf to create a 'data.fdf' file from my user's input. This is working correctly. I want to use this file to populate fields of existing forms that I have created and saved as PDF's. From NodeJs (Express), how can I access the PDF object to populate the fields? I do not need to alter the PDF, simply to populate and save a flattened version.


Wes Bailey


3 Answers

Voted Best Answer

Thanks for your response about modifying the FDF doc with the PDF data and then opening. I could very easily write a method to parse this text as you describe. Is there any reference documentation you can refer me to for the correct formatting / what data to replace? With that info I can make short work of this issue.

This is covered in the FDF Toolkit documentation provide by Adobe.


By George Kaiser   

If you want to do this on a server, you cannot use Adobe Acrobat (for legal and technical reasons). To get a quick solution going, take a look at pdftk (http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/). This allows you to pass in a PDF file and a FDF file and fill the form fields and flatten the document.

Adobe has the FDFToolkit, that allows you to merge and flatten, but as far as I know, the version available is pretty old, and you may have a hard time getting it to run on a modern system (last time I tried, I gave up): http://www.adobe.com/devnet/acrobat/fdftoolkit.html

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


Karl Heinz Kremer   

If you can place the form name and location into the FDF file then opening the FDF file should open the PDF and apply the values within the FDF to the fields.

This is how PDF forms processed on web scripting pages work and I have done it on network and local drives.

The PDFtk lets the user specify the fdf file and PDF independently.


George Kaiser   


Please specify a reason: