From 02d02d11e5484d70b67d4e6610f730e26f713fd2 Mon Sep 17 00:00:00 2001 From: Tilman Hausherr Date: Fri, 3 Jan 2025 11:21:17 +0000 Subject: [PATCH] PDFBOX-4627, PDFBOX-5054: ignore non-stencil images in type3 charprocs with d1 or uncolored tiling patterns git-svn-id: https://svn.apache.org/repos/asf/pdfbox/trunk@1922858 13f79535-47bb-0310-9956-ffa450edef68 --- .../contentstream/operator/graphics/BeginInlineImage.java | 4 ++++ .../pdfbox/contentstream/operator/graphics/DrawObject.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java index 73970fab4e1..63ea05559ab 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/BeginInlineImage.java @@ -54,6 +54,10 @@ public void process(Operator operator, List operands) throws IOExceptio { return; } + if (!image.isStencil() && !context.isShouldProcessColorOperators()) + { + return; + } context.drawImage(image); } diff --git a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/DrawObject.java b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/DrawObject.java index eb521c47ad2..ee8497e7b55 100644 --- a/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/DrawObject.java +++ b/pdfbox/src/main/java/org/apache/pdfbox/contentstream/operator/graphics/DrawObject.java @@ -70,7 +70,11 @@ public void process(Operator operator, List operands) throws IOExceptio } else if (xobject instanceof PDImageXObject) { - PDImageXObject image = (PDImageXObject)xobject; + PDImageXObject image = (PDImageXObject) xobject; + if (!image.isStencil() && !context.isShouldProcessColorOperators()) + { + return; + } context.drawImage(image); } else if (xobject instanceof PDFormXObject)