This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
FDFToolkit for Java will meet some of your needs. It is an API provided free by Adobe and can be found here.
I've used this API, in conjunction with Adobe Illustrator, Acrobat Professional, to create dynamic, web-based forms. As it existed in a web environment, I used a Servlet to implement the libraries and control the form processing, pdf generation, etc.
FREE Java PDF generation APIs is available at called Smart JPrint. <a href="http://www.activetree.com">http://www.activetree.com</a> It not only generates PDF for ant kind of (server and front end)Java programs, it lets you send the output to a selected printer (incase you want to print the output), allows you to preview the PDF output in a nice GUI window so that your user can view the pages generated from your program. User can then output the selected pages or range of pages to a printer or to a PDF file. Use the preview feature when you are using the Smart JPrint APIs in the Swing GUI programs.
Therefore, you can create your PDF dynamically from your J2EE server using the Smart JPrint PDF and printing APIs and then put the document name as the link to the newly displayed HTML page. The PDF file it generates can be automatically be printed to a printer using the JPrint api too ofcource silently, i.e. without showing any dialog for page and printer sleection etc.). The printer is selected automatically by the JPrint APIs for you.
It is just wanderful with the following features.
100% Java and needs no other library. You can convert RTF documents into PDF from swing components such as JTextPane, JEditorPane, JTextArea and other kind of custom JTextComponent. JTable content too can be easily converted to PDF. THE NICE THING WITH this APIs is that it automatically breaks the lines and columns to create number of pages and uses the PAGE FORMAT YOU PROVIDE. It has a System.out.println kind of APIs to output the TEXT (with RTF styles, e.g. COLOR, FONT, UNDERLINE), ICONS/IMAGES, and 2D Graphics using its write() methods. The lines are automatically broken into pages. Look at the online APPLET demo that lets you get the test of PDF generation online and instantly.
You can add header and footer to the generated pages using your own custom format.