As part of my work, I have to fill in a particular form that is provided to me. That form comes in either PDF or Word (.doc) sources. In the end, a PDF document needs to be generated. The PDF form is publicly available at


The Word document is in the same location, but downloads instead of displays in the browser.

I know nothing of the internals of either PDF or Word (.doc). My goal is to fill in the form programmatically from a database of answers (probably a flat CSV text file). The alternative is to fill the form in my hand each time, which is very time-consuming. I can program, so I'm wondering how I should go about learning how to do this in the most efficient manner possible. I use Emacs and so I'm wondering if there is some software that can look inside and manipulate a PDF or Word document? I could start studying up on PDF internals, etc., but I'm wondering if someone knows of a great resource that they would recommend on how to fill in a PDF or Word document using some open-source tool; in the alternative, what would be a great resource for learning how to do this.

If this question is too general, I guess a resource for where to ask this question other than here would be greatly appreciated.

  • This question is very broad, and I'll vote to close. However, you might be interested in the pdf-tools package, which uses the poppler library to open, display and manipulate pdfs. – Tyler Dec 4 '18 at 2:14
  • The question is not appropriate for Emacs SE: it has nothing to do with emacs. – NickD Dec 4 '18 at 2:40
  • 2
    pdftk. But pdftk Form.pdf dump_data_fields gives nothing back. The document does not contain data fields that can filled in. You can open the word document with libreoffice and add data field controls. Afterwards you can generate an fdf with pdftk Form.pdf generate_fdf. The fdf has a simple structure. You can fill in the values (after /V). Afterwards you can apply the fdf to the pdf with pdftk Form.pdf fill_form Form.fdf output FormFilled.pdf. – Tobias Dec 4 '18 at 3:02
  • @Tyler AFAIK the Edit Annotation function of pdf-tools does not fill in the data fields. It just annotates them. – Tobias Dec 4 '18 at 3:06
  • @tobias yes, i made a comment not an answer, because this doesn't answer their question. OP said they are interested in studying pdf internals and editing pdfs with Emacs, so pdf-tools/poppler seems like a good place to start – Tyler Dec 4 '18 at 3:27

@Tobias Has given the perfect answer. I opened the .doc file in libreoffice and added forms, then exported the document as a PDF. pdftk then found each of the fields and exported a template that can be used. I can populate the template and send it to through the PDF. All of this can be done programmatically; the problem was getting the forms into the PDF document, which required libreoffice (or a paid version of Acrobat). Thank you for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.