Hi,
I looked again and I see my advice was wrong, the protected method I
looked at is final, and the other one is private.
The next thing that you could try is to create your own
SetGraphicsStateParameters class, and call addOperator(new
SetGraphicsStateParameters()); in your own drawer.
The new class should be like the old class but with this modification
PDExtendedGraphicsState gs =
context.getResources().getExtGState(graphicsName); // existing line
gs.setNonStrokingAlphaConstant(1f);
gs.setStrokingAlphaConstant(1f);
Tilman
On 17.05.2023 22:28, Tres Finocchiaro wrote:
What you could try is to extend *getNonStrokingPaint* and
*getStrokingPaint*
and set both values to 1 (that is the default if no ca/CA entry
exists)
with *setAlphaConstant*() and *setNonStrokeAlphaConstant*().
Thanks. Do you mind offering a pointer on how to perform this? For
example, *getNonStrokingPaint*() and *getStrokingPaint*() return Paint
objects. Should I be forcing *setAlphaConstant*() and
*setNonStrokeAlphaConstant*() like this code example?
https://github.com/apache/pdfbox/blob/f7ac68e7b367a43e36e74e1ec915c25b117304cb/pdfbox/src/main/java/org/apache/pdfbox/contentstream/PDFStreamEngine.java#L237-L238
As a quick test, I hard-coded them to always set/return "1" in
*PDGraphicsState * and it appears to fix the rasterization of the
second page, but I'd like to be able to make this toggleable.
Here's my current code:
https://github.com/qzind/tray/pull/1108/files#diff-aba44d09ef8de16a001d790ae7671bea33941071306f549b8dc290504e3e1d1b,
which is largely based on a conversation here:
https://issues.apache.org/jira/browse/PDFBOX-4123?focusedCommentId=17529733&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17529733
<https://issues.apache.org/jira/browse/PDFBOX-4123?focusedCommentId=17529733&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17529733>.
image.png
- tres.finocchi...@gmail.com