Way to convert jPedal pdf to PDFDocumentGraphics2D

261 views Asked by At

I use the PdfDecoder class from jPedal to attempting to convert/paint a pdf file to a PDFDocumentGraphics2D object. The PDFDocumentGraphics2D is an extension of javas AWT Graphics class, and part of Apache FOP (http://xmlgraphics.apache.org/fop/).

Is there another way to .paint(...) the pdf onto PDFDocumentGraphics2D except using the commercial-only function renderPageOntoGraphics2D from jPedals PdfDecoder class? I have a feeling it might be done by going through the whole tree of the pdf, and .paint() everything. This seems tedious though, since it's my experience that it is quite hard to get all text, images and forms out of a pdf file by using the PdfDecoder class.

I am also open for alternative/better ways to read in a pdf file, and painting it onto a PDFDocumentGraphics2D object!

1

There are 1 answers

1
mark stephens On

You could hack into the main parsing engine in PdfStreamDecoder or implement your own version of the DynamicVectorRenderer JPedal writes to but it is going to be quite a hack.