From ae00663faed0f922c77dd5c588e97ff3f6f1cb1f Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 28 Aug 2024 20:19:13 +0300 Subject: [PATCH] PDF/UA. Not process content item in XObject for tilling patterns --- .../verapdf/gf/model/factory/operators/OperatorParser.java | 2 +- .../org/verapdf/gf/model/impl/operator/xobject/GFOp_Do.java | 6 ++++-- .../java/org/verapdf/gf/model/impl/pd/images/GFPDXForm.java | 6 ++++-- .../org/verapdf/gf/model/impl/pd/images/GFPDXObject.java | 6 ++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/validation-model/src/main/java/org/verapdf/gf/model/factory/operators/OperatorParser.java b/validation-model/src/main/java/org/verapdf/gf/model/factory/operators/OperatorParser.java index 0025a948a..b3a80431c 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/factory/operators/OperatorParser.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/factory/operators/OperatorParser.java @@ -537,7 +537,7 @@ void parseOperator(List processedOperators, parentStructElem = this.parentStructElem; } GFOp_Do op_do = new GFOp_Do(arguments, resourcesHandler.getXObject(getLastCOSName(arguments)), - resourcesHandler, this.graphicState.clone(), parentStructElem, parentsTags); + resourcesHandler, this.graphicState.clone(), parentStructElem, parentsTags, isRealContent); org.verapdf.model.pdlayer.PDXObject pdxObject = op_do.getXObject(); if (pdxObject != null) { this.transparencyGraphicState.setVeraXObject((GFPDXObject)pdxObject); diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/operator/xobject/GFOp_Do.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/operator/xobject/GFOp_Do.java index 5dcdecac1..34168f4f4 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/operator/xobject/GFOp_Do.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/operator/xobject/GFOp_Do.java @@ -52,16 +52,18 @@ public class GFOp_Do extends GFOperator implements Op_Do { private final GraphicState inheritedGraphicState; private final COSObject parentStructElem; private final List parentsTags; + private final boolean isRealContent; public GFOp_Do(List arguments, org.verapdf.pd.images.PDXObject pdXObject, PDResourcesHandler resourcesHandler, GraphicState inheritedGraphicState, - COSObject parentStructElem, List parentsTags) { + COSObject parentStructElem, List parentsTags, boolean isRealContent) { super(arguments, OP_DO_TYPE); this.pbXObject = pdXObject; this.resourcesHandler = resourcesHandler; this.inheritedGraphicState = inheritedGraphicState; this.parentStructElem = parentStructElem; this.parentsTags = parentsTags; + this.isRealContent = isRealContent; this.xObject = getXObject(); } @@ -90,7 +92,7 @@ public PDXObject getXObject() { return null; } this.xObject = GFPDXObject.getTypedPDXObject(this.pbXObject, this.resourcesHandler, inheritedGraphicState, - this.parentStructElem, this.parentsTags); + this.parentStructElem, this.parentsTags, isRealContent); return this.xObject; } diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXForm.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXForm.java index 7c42747e8..bd0ef39f8 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXForm.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXForm.java @@ -68,10 +68,11 @@ public class GFPDXForm extends GFPDXObject implements PDXForm { private final boolean isSignature; private final boolean isAnnotation; + private final boolean isRealContent; public GFPDXForm(org.verapdf.pd.images.PDXForm simplePDObject, PDResourcesHandler resourcesHandler, GraphicState inheritedGraphicState, COSObject parentStructElem, List parentsTags, - String defaultLang, boolean isAnnotation, boolean isSignature) { + String defaultLang, boolean isAnnotation, boolean isSignature, boolean isRealContent) { super(simplePDObject, resourcesHandler.getExtendedResources(simplePDObject.getResources()), X_FORM_TYPE); this.inheritedGraphicState = inheritedGraphicState; this.parentStructElem = parentStructElem; @@ -80,6 +81,7 @@ public GFPDXForm(org.verapdf.pd.images.PDXForm simplePDObject, PDResourcesHandle this.defaultLang = defaultLang; this.isAnnotation = isAnnotation; this.isSignature = isSignature; + this.isRealContent = isRealContent; } @Override @@ -200,7 +202,7 @@ private void initializeGroups() { private void parseContentStream() { GFPDContentStream gfContentStream; - if (isAnnotation || (!PDFFlavours.isPDFUARelatedFlavour(StaticContainers.getFlavour()))) { + if (!isRealContent || isAnnotation || (!PDFFlavours.isPDFUARelatedFlavour(StaticContainers.getFlavour()))) { gfContentStream = new GFPDContentStream( (org.verapdf.pd.images.PDXForm) this.simplePDObject, resourcesHandler, this.inheritedGraphicState, new StructureElementAccessObject(this.simpleCOSObject), diff --git a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXObject.java b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXObject.java index 23d6a86f0..939d45d5e 100644 --- a/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXObject.java +++ b/validation-model/src/main/java/org/verapdf/gf/model/impl/pd/images/GFPDXObject.java @@ -68,10 +68,12 @@ public Boolean getcontainsSMask() { } public static PDXObject getTypedPDXObject(org.verapdf.pd.images.PDXObject xObject, PDResourcesHandler resources, - GraphicState inheritedGraphicState, COSObject parentStructElem, List parentsTags) { + GraphicState inheritedGraphicState, COSObject parentStructElem, + List parentsTags, boolean isRealContent) { ASAtom type = xObject.getType(); if (ASAtom.FORM.equals(type)) { - return new GFPDXForm((PDXForm) xObject, resources, inheritedGraphicState, parentStructElem, parentsTags, null, false, false); + return new GFPDXForm((PDXForm) xObject, resources, inheritedGraphicState, parentStructElem, parentsTags, + null, false, false, isRealContent); } else if (ASAtom.IMAGE.equals(type)) { return new GFPDXImage((PDXImage) xObject, resources, inheritedGraphicState.getFillColorSpace()); } else if (ASAtom.PS.equals(type)) {