From 04511c607b43d89b72f21adcbb078119e93b75bd Mon Sep 17 00:00:00 2001 From: ritwic Date: Thu, 19 Jun 2025 07:51:05 +0800 Subject: [PATCH] Parse the group blend mode from ExtGState in Form XObject Resources --- src/core/evaluator.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/core/evaluator.js b/src/core/evaluator.js index edf02c2c0..0dfd1a5e8 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -510,6 +510,27 @@ class PartialEvaluator { smask.backdrop = colorSpace.getRgbHex(smask.backdrop, 0); } + // Parse group blend mode from ExtGState if it's in FormX Resources + const localResources = dict.get("Resources"); + if (localResources instanceof Dict) { + const extGState = localResources.get("ExtGState"); + if (extGState instanceof Dict) { + for (const val of extGState.getRawValues()) { + if (val instanceof Dict && val.has("BM")) { + const blendMode = val.get("BM"); + if (blendMode != null) { + try { + groupOptions.blendMode = normalizeBlendMode(blendMode); + break; + } catch (ex) { + console.error(`Invalid blend mode in ExtGState: ${blendMode}`, ex); + } + } + } + } + } + } + operatorList.addOp(OPS.beginGroup, [groupOptions]); }