Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fill out a pdf file programatically? [closed]

What techniques available to fill a pdf form automatically using external data and save them. I have to use data from a database to fill a template pdf and save a copy of it on disk with that data. Language and platform is not issue but it would be good if it can run on windows and Linux.

Any one can guide me through it or point to any article that might help.

like image 595
particle Avatar asked Jun 24 '10 09:06

particle


People also ask

How do you save a fillable PDF and keep it fillable?

How to download/save the fillable PDF to your computer: Right click on the form link (Apply Button) and select “Save target as…” or “Save link as…” Filling the form using Adobe Reader: You can either type information directly into each field or cut and paste text from your own word processor.

What is an Adobe Acroform?

Acroforms are a combination of the. following items: A traditional PDF that defines the static layout and graphics of the form. Interactive form fields that are bolted on top with the form tools of the Adobe Acrobat program. These form tools are a small subset of what's available in AEM Forms Designer.


1 Answers

To elaborate on the answer by duffymo you've approved, allow me to share a chapter of my book with you: manning.com/lowagie2/samplechapter6.pdf

In section 6.3.5, you'll find out how to create a PDF template using Open Office, and listing 6.19 will show you how to fill it out programmatically:

PdfReader reader = new PdfReader(src);
PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest));
AcroFields form = stamper.getAcroFields();
form.setField(key, value);
stamper.setFormFlattening(true);
stamper.close();
reader.close();

Just like Frank Rem, I need to add that I'm the original developer of iText, the author of the books about iText, and the current CEO of the iText Group, answering this mail straight from the ISO committee that is discussing ISO-32000-2 (aka PDF 2.0) ;-)

like image 114
Bruno Lowagie Avatar answered Oct 08 '22 10:10

Bruno Lowagie