When you want to convert a java.awt.print.Printable to a pdf file, your first course of action might be to Google for "java printable pdf". If you do that though, all you get is links about how to send a pdf file to the (hardware) printer in java or how to "read" a pdf file in Java. No one seemed to have written an article about how to convert a java.awt.Printable to a pdf file. This is that article. Ideal for generating PDF's on your server and, for example, emailing them to your users.
http://www.zenbi.co.uk/2011/09/04/printable-to-pdf/
-
From java.awt.print.Printable to PDF (3 messages)
- Posted by: Gert-Jan Schouten
- Posted on: September 06 2011 11:55 EDT
Threaded Messages (3)
- License requirements by Fro Car on September 06 2011 14:45 EDT
- Itext 2.1.7 also works by Gert-Jan Schouten on September 11 2011 10:46 EDT
- Use the Apache FOP which is free for generating PDF in java by Rajnish Kumavat on September 14 2011 02:16 EDT
-
License requirements[ Go to top ]
- Posted by: Fro Car
- Posted on: September 06 2011 14:45 EDT
- in response to Gert-Jan Schouten
The author says this uses itext 5.0.2, but should also work with newer versions.
However, the question really is whether it will work with _older_ versions of itext as well (such as v2.0.8).
Itext isn't what it used to be, in version 5 it changed it's licensing to the Affero GPL 3.0 license, which means that you may set yourself up for one major licensing nightmare if you use this solution in a commercial solution and think you don't need to buy their license. The Affero GPL license ain't like the GPL - it's much more aggressively viral, including adding requirements for networked and web-based solutions.
-
Itext 2.1.7 also works[ Go to top ]
- Posted by: Gert-Jan Schouten
- Posted on: September 11 2011 10:46 EDT
- in response to Fro Car
Hello all,
Thanks for the comments! I didn't know about the licensing issue. I’ve tested my solution with itext-2.1.7.jar and I am happy to report that this works just fine, the 2.1.7 jar is drop-in compatible.
-
Use the Apache FOP which is free for generating PDF in java[ Go to top ]
- Posted by: Rajnish Kumavat
- Posted on: September 14 2011 02:16 EDT
- in response to Gert-Jan Schouten
Use the Apache FOP which is free for generating PDF in java. We are usign this from ages