I am working with the iText library to do some PDF manipulation in Java, but I am trying to do something in which the iText API is starting to overwhelm me. I really just need a quick tutorial, or some pseudo-code, but here is what I am trying to accomplish:
- User selects a series of check boxes, indicating which PDFs he or she wishes to print.
- Based on user input, grab 1 – x PDF template files. Each page has a series of AcroFields which need to be filled out.
- One such page requires drawing some custom graphics on the PDF, i.e. accessing the PdfContentByte object and manipulating that to insert images and rectangles.
- If it possible, I would like to avoid writing temporary PDFs to disk. The previous programmer did this, and it has been messy to deal with that. I’d much prefer to grab the template file, manipulate it in memory and serve it directly to the browser.
I seem to have all the pieces, but I can’t quite put it all together. Point #4 is what’s been really tripping me up.
TIA.
So, here is the answer I was finally able to come up with:
Thanks go out to this tutorial which I eventually found on my own:
http://itextpdf.com/examples/iia.php?id=127