PDF forms, the web, and Struts...
Have written in a while. I am going to make myself write more if not only to remind myself of things I will forget.Just finishing up some refactoring of an application that was trying to duplicate a very involved PDF form into html. The final product was then written into a PowerPoint template. It was rather nasty. I decided to keep the PDF form and just push that as the UI. Now the user will be more comfortable with editing the data considering it looks and feels more natural. Also helped to clean up the back-end data now that Fdf data is being saved rather than a rather stringy object graph.
I used iText to handle the opening of, pre/re-population of form data, and streaming of PDFs to the browser. It was also the only library that would open and save our PDF templates. I tried some commercial libraries and they just wouldn't save or stream the final product. iText being open source software also makes the price more attractive.
Things to note and remember about this project...
1. You can't manipulate an iText PdfReader and then reuse it. It throws an exception complaining that the reader is being reused. You have to change, save, and reopen - even if you are just doing all of this in memory.
2. If you are using Struts and want to send something like a PDF as the response, return a null ActionMapping.
0 Comments:
Post a Comment
<< Home