-2

I am trying to print out custom commercial invoices based on a known set of data and allowing for an unknown set of data. My known data includes addresses, general contact information, etc.

What I want is to be able to use a PDF template of a "commercial invoice" and have the known data auto-populated into the form where available. Then, the user can download the (incomplete) PDF and fill in the empty / optional form fields using their own collection of information - stuff like Tax ID, recipient care-of names, internal tracking ids, etc.

How can I use JSON / XML + python + HTML + a PDF template to auto-fill some info and leave some info empty, on an editable PDF form?

Thanks!

Jon Mitten
  • 1,965
  • 4
  • 25
  • 53

1 Answers1

1

You essentially want server-side filling of the form.

There are several possible approaches.

An industry-strength approach would be using a dedicated application which could be called via command line (FDFMerge by Appligent comes to my mind, which is very easy to integrate, as all you'd have to do is to assemble the FDF data, and then the command string).

Another approach is to use one of the PDF creating libraries out there (iText, pdflib or Adobe's PDF Library come to my mind here). In this case, you have considerably more programming effort, but may have somewhat more flexibility.

Max Wyss
  • 3,549
  • 2
  • 20
  • 26
  • Amazingly, none of these solutions are free or open source. Is that the nature of the beast? I was not looking to spend hundreds or thousands of dollars on PDFs. – Jon Mitten Nov 17 '15 at 22:39
  • As far as I understand it, iText is open source (but I will stand corrected if it is not the case). A potential workaround would be working with (X)FDF which do have the capability to pull in the base PDF and fill the form client-side, when it gets opened. – Max Wyss Nov 17 '15 at 23:04
  • Ah, this could be a link to a service company,then: http://itextpdf.com/ Here's the git repo: https://github.com/itext/itextpdf – Jon Mitten Nov 17 '15 at 23:06