Skip to content

Commit

Permalink
PDF/UA. Not process content item in XObject for tilling patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Sep 16, 2024
1 parent dcf895e commit 076e854
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ void parseOperator(List<org.verapdf.model.operator.Operator> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,18 @@ public class GFOp_Do extends GFOperator implements Op_Do {
private final GraphicState inheritedGraphicState;
private final COSObject parentStructElem;
private final List<String> parentsTags;
private final boolean isRealContent;

public GFOp_Do(List<COSBase> arguments, org.verapdf.pd.images.PDXObject pdXObject,
PDResourcesHandler resourcesHandler, GraphicState inheritedGraphicState,
COSObject parentStructElem, List<String> parentsTags) {
COSObject parentStructElem, List<String> 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();
}

Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ private void addAppearance(List<PDXForm> list, PDAppearanceStream toAdd) {
PDResourcesHandler resources = this.resources.getExtendedResources(toAdd.getResources());
COSString annotLang = getLang();
GFPDXForm xForm = new GFPDXForm(toAdd, resources, null, getParentDictionary(), Collections.emptyList(),
annotLang == null ? null : annotLang.getString(), true, isSignature());
annotLang == null ? null : annotLang.getString(), true, isSignature(), false);
this.containsTransparency |= xForm.containsTransparency();
list.add(xForm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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;
Expand All @@ -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
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,12 @@ public Boolean getcontainsSMask() {
}

public static PDXObject getTypedPDXObject(org.verapdf.pd.images.PDXObject xObject, PDResourcesHandler resources,
GraphicState inheritedGraphicState, COSObject parentStructElem, List<String> parentsTags) {
GraphicState inheritedGraphicState, COSObject parentStructElem,
List<String> 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)) {
Expand Down

0 comments on commit 076e854

Please sign in to comment.