It turned out PDFDocumentGraphics2D was not so operational anymore. Somewhere along the way it broke. I've fixed it again [1] and added a usage example [2]. That means you'll have to download FOP Trunk [3].
[1] http://svn.apache.org/viewvc?rev=1183620&view=rev [2] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/embedding/java/embedding/ExampleJava2D2PDF.java?view=markup [3] http://xmlgraphics.apache.org/fop/download.html But guys, talking about PDFDocumentGraphics2D is getting very off-topic for this list. Please take that part to [email protected] from here. On 14.10.2011 23:54:56 Angelo zerr wrote: > Hi Steve > > 2011/10/14 Steve Hannah <[email protected]> > > > > > > > > > > It works but I have the same problem than PDFBox. I must manage x and y > > > position (increment x and y when I add some text). > > > > > > > It appears that PDFDocumentGraphics2D is just a Graphics2D context. Then > > presumably you could pass it to the paint() method of any AWT or Swing > > component to have that component paint itself to the PDF. E.g. Just use a > > JTextPane or a JTable, then pas the PDFDocumentGraphics2D object to their > > paint() methods > > > > Ok thank's for this information. > > > > > > > > > > I have started to manage that with PDFBox and it works great (increment x > > > when text is added, increment y when text is too long for the line, etc). > > > > > > I don't see the advantage to use PDFDocumentGraphics2D instread of using > > > PDFBox PDPageContentStream. > > > I'm afraid with FOP because: > > > > > > * PDFDocumentGraphics2D is not documented. It seems that nobody (google > > > tell me that) has used PDFDocumentGraphics2D to create PDF from scratch. > > > > > One google search found some API docs. > > > > http://www.jarvana.com/jarvana/view/org/apache/xmlgraphics/fop/1.0/fop-1.0-javadoc.jar!/org/apache/fop/svg/PDFDocumentGraphics2D.html > > > > Possibly old, but that's what 10 seconds of research found. > > > > When I said documented, I meant that I have no found documentation in the > FOP WebSite or other blog which explains how to use this class. I have not > found sample which use this class. > Your link is the Javadoc that I have already read because I have the sources > of FOP in my Eclipse Workspace. > > Regards Angelo > > > > > Best regards > > > > Steve > > Jeremias Maerki

