Hi,
TexturePaint is used for patterns, i.e. rectangles that repeat itself.
GetImage() returns a single pattern image. You can test this by saving
that BufferedImage with ImageIO.write() and look what's in it.
About your problem: the cause is either a bug in Batik, or a missing
implementation there, or that it's impossible (does SVG have a concept
about patterns?), or the cause is an old bug in renderPageToGraphics(),
that it fails when there is some sort of transformation. I don't
remember what ticket number it is, but it's many years old, and we
haven't been able to fix it.
Tilman
On 24.06.2024 13:39, Rich Stafford wrote:
I am still working on getting the hatched object in a PDF to render when
generating SVG, using the SVGGraphics2D output, called from the PDFBox
PDFRenderer.renderPageToGraphics() method.
I have subclassed SVGGraphics2D class, specifically the fill(Shape s) method.
For my PDF hatch data, this method is being called with a PDFBox TilingPaint
object. This class is 'private', but for testing, I've modified it to 'public'
to be able to access from my module.
The TilingPaint object has an AWT 'Paint' member, which is an AWT
'TexturePaint' object. I am able to use it's 'getImage()' method to access a
BufferedImage object.
My question is, what is contained in that BufferedImage object? Does it
contain the same rendered view of the hatched PDF data as I can see when I
generate a full raster view using PDFRenderer.renderImageWithDPI() method?
Rich
***
At 02:01 AM 6/18/2024, Andreas Lehmkühler wrote:
Hi,
Am 18.06.24 um 01:10 schrieb Rich Stafford:
I have a simplified PDF case that renders (using PDFBox) differently between
JPG and SVG output modes.
PDFBox doesn't have a SVG output mode. I guess you are using some code/tool
from the Apache XMLGraphics project so that you might ask them for help.
https://xmlgraphics.apache.org/
Andreas
This PDF has a simple line element, and a lime colored rectangle that is filled
with some lime color horizontal lines and shows the black line behind it.
When rendering to JPG, it matches the input PDF.
When rendered to SVG, the rectangle is filled with opaque black.
I am using PDFBox 3.0.2, and Batik 1.17.
The following link is to an open share of a file 't2.zip. In this zip is:
t2.pdf the PDF being rendered
t2.jpg the rendered JPG file
t2.svg the rendered SVG file
https://drive.google.com/file/d/1qbuM6O-yNdbr8Ip32q6jp0Z9demfSZBe/view?usp=sharing
Any help or advice would be appreciated!
Rich Stafford
Chief Scientist
eQuorum Corporation
---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail:users-h...@pdfbox.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail:users-unsubscr...@pdfbox.apache.org
For additional commands, e-mail:users-h...@pdfbox.apache.org