Axel Howind created PDFBOX-6001:
-----------------------------------
Summary: PDFRenderer: add the option to pass a factory method for
creating the BufferedImage
Key: PDFBOX-6001
URL: https://issues.apache.org/jira/browse/PDFBOX-6001
Project: PDFBox
Issue Type: New Feature
Reporter: Axel Howind
Attachments: possibility_to_pass_an_image_factory_to_the_renderer.patch
I have added a method renderPage() to PDFRenderer where it is possible to
provide a factory method for creating the BufferedImage for the page.
This allows the user to control the exact type of the BufferedImage to be
created. In my use case, I use PDFBox in a JavaFX application. The page is
rendered using PDFBox to a BufferedImage and then converted to a
javafx.scene.image.Image.
With this patch, I can pass a factory method that creates a subclass of
BufferedImage that shares the underlying pixel data with an instance of
javafx.scene.image.Image. I can then render the page and directly use the
JavaFX image in my application without any conversion or copying of the raster
data. In my application, that improves page rendering times by about 40%.
This might also be beneficial for other use cases where an image with a
specific pixel format is needed.
Existing code that uses PDFBox does not have to be updated as the signatures of
existing methods remain unchanged.
I don't know if this will be accepted, I just wanted to upstream because it
might be a useful features for others as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]