Thanks. I've added the code to our existing custom "process()" function.... it looks like this:
public void process(Operator operator, List<COSBase> operands) throws > IOException { > if (operands.isEmpty()) { > throw new MissingOperandException(operator, operands); > } else { > COSBase base0 = operands.get(0); > if (base0 instanceof COSName) { > COSName objectName = (COSName)base0; > > > > > *// Disable alpha for lines, etc PDExtendedGraphicsState gs > = context.getResources().getExtGState(objectName); if(gs != > null) { gs.setNonStrokingAlphaConstant(1f); > gs.setStrokingAlphaConstant(1f); }* ... Unfortunately, it doesn't seem to have the same effect as the brute-force approach of "hard-coded them to always set/return '1' in PDGraphicsState". Do you have any suspicions as to why? This is reproducible using the following steps: 1. Windows 11, Java 11 2. PDF from original email in this thread 3. XPS Document Writer, DPI set to 300 4. Custom form size: 4x6 P.S. This rasterization seems specific to Windows. - tres.finocchi...@gmail.com On Thu, May 18, 2023 at 1:30 AM Tilman Hausherr <thaush...@t-online.de> wrote: > 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 > >