2

I need to capture the graphics primitives from calls to java.awt.Graphics2D. The calls are made through an Open Source toolkit (Apache's PDFBox) and normally rendered in a JPanel. I would like to intercept these calls and translate them to SVG so I can build a non-graphics data model (e.g. tables, graphs, etc.). I'll be happy for any type of hack at this stage, which might include:

  • replacing the Graphics2D library with MyGraphics2D
  • Finding a Graphics2D that supported SVG output and capturing that
  • intercepting the calls to Graphics2D (I'd prefer not because I have to manage the affine transformations)

Subsidiary question: Does Graphics2D use the Graphics library? In which case if I capture at this level the transformations should have been applied.

peter.murray.rust
  • 37,407
  • 44
  • 153
  • 217

2 Answers2

2

I would have a look at the Batik project which provides an extension of Graphics2D to output SVG files.

Guillaume Polet
  • 47,259
  • 4
  • 83
  • 117
0

JFreeSVG is another option to consider, it provides a fast lightweight implementation of the Graphics2D API.

David Gilbert
  • 4,427
  • 14
  • 22