Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3697

RFC: Integration of Graphics2D->PDFBox bridge



    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Won't Do
    • None
    • None
    • Writing
    • None


      I've build a Graphics2D -> PDFBox bridge. It allows you to draw using Graphics2D into a PDF. iText has such a feature for a long time now. In PDFBOX-102 it seems you don't want such a feature, or at least don't want to implement it. I hope I must not explain why drawing to an image and placing that image in the PDF is not the right solution. Depending on the output device this may result in horrible quality.

      As I want to migrate my usages of flying-saucer to openhtmltopdf (https://github.com/danfickle/openhtmltopdf) I need a way to embed report graphs in high quality into the PDF. Because of this I build this bridge: https://github.com/rototor/pdfbox-graphics2d

      The bridge is build from ground up by myself. I did not use any code of the iText-Graphics2D bridge.

      Currently it can render text only as vector shapes. But it supports different gradient paints and texture paints. openhtmltopdf uses it to draw inline SVGs.

      I would like to contribute this bridge to PDFBox, as I think this is a feature PDFBox currently lacks. But I am not sure if you want this at all.

      The bridge uses reflection to access e.g. the Batik gradient paints without referencing Batik. The paint mapping is something which can never be really finished, as they can be many paint implementations. Because of this the bridge allows to customize all different kind of mappings (color/paint/font).

      I don't know if it is better to keep this bridge separate or if it is better to integrate it into PDFBox. This is something I would like you to decide. If you would like it, I would prepare a patch.




            Unassigned Unassigned
            rototor Emmeran Seehuber
            1 Vote for this issue
            3 Start watching this issue