Reputation: 1575
I'm looking for a way to build a PDF from a Draw2D canvas. I believe I've seen a way to do this from Java2D, but not Draw2D. There are many graphical elements involved (as well as text) so I don't think I can go the XSLT route. Does anyone have any suggestions?
Upvotes: 2
Views: 1103
Reputation: 2610
iText is a library for creating PDF from java application. iText implements its adapter for Graphics2D class, see this. So you can draw any AWT/Swing component to the PDF.
Eclipse Graphiti contains another adapter. It adapts draw2d Graphics to awt's Graphics2D. You can download it and maybe little edit for your needs. So using those adapters you can draw your root figure to the PDF. It works, I have tried that.
Upvotes: 0
Reputation: 4740
Maybe you can succeed using "jPod".
It comes with a simple example how to create PDF content using its "CSCreator", which publishes the PDF graphics operation primitives as an API. While i do not use draw2d, i assume it shouldn't be to hard to map to this API.
Roughly it should go like this
Upvotes: 0