Skip to content

Commit

Permalink
Disable content item parsing for annotation appearance stream
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPlusov committed Mar 19, 2024
1 parent 60b2fa1 commit c12d963
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,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(), "",
annotLang == null ? null : annotLang.getString(), isSignature());
annotLang == null ? null : annotLang.getString(), true, isSignature());
this.containsTransparency |= xForm.containsTransparency();
list.add(xForm);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,18 @@ public class GFPDXForm extends GFPDXObject implements PDXForm {
private final PDColorSpace blendingColorSpace;

private final boolean isSignature;
private final boolean isAnnotation;

public GFPDXForm(org.verapdf.pd.images.PDXForm simplePDObject, PDResourcesHandler resourcesHandler,
GraphicState inheritedGraphicState, COSObject parentStructElem, String parentsTags,
String defaultLang, boolean isSignature) {
String defaultLang, boolean isAnnotation, boolean isSignature) {
super(simplePDObject, resourcesHandler.getExtendedResources(simplePDObject.getResources()), X_FORM_TYPE);
this.inheritedGraphicState = inheritedGraphicState;
this.parentStructElem = parentStructElem;
this.parentsTags = parentsTags;
this.blendingColorSpace = getBlendingColorSpace();
this.defaultLang = defaultLang;
this.isAnnotation = isAnnotation;
this.isSignature = isSignature;
}

Expand Down Expand Up @@ -197,10 +199,9 @@ private void initializeGroups() {
}

private void parseContentStream() {
List<PDContentStream> streams = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
GFPDContentStream gfContentStream;
if (!PDFAFlavour.IsoStandardSeries.ISO_14289.equals(StaticContainers.getFlavour().getPart().getSeries()) &&
PDFAFlavour.SpecificationFamily.WCAG != StaticContainers.getFlavour().getPart().getFamily()) {
if (isAnnotation || (PDFAFlavour.IsoStandardSeries.ISO_14289 != StaticContainers.getFlavour().getPart().getSeries() &&
PDFAFlavour.SpecificationFamily.WCAG != StaticContainers.getFlavour().getPart().getFamily())) {
gfContentStream = new GFPDContentStream(
(org.verapdf.pd.images.PDXForm) this.simplePDObject, resourcesHandler,
this.inheritedGraphicState, new StructureElementAccessObject(this.simpleCOSObject),
Expand All @@ -212,6 +213,7 @@ this.inheritedGraphicState, new StructureElementAccessObject(this.simpleCOSObjec
parentStructElem, parentsTags, defaultLang, isSignature);
}
this.contentStreamContainsTransparency = gfContentStream.isContainsTransparency();
List<PDContentStream> streams = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
streams.add(gfContentStream);
this.contentStreams = streams;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static PDXObject getTypedPDXObject(org.verapdf.pd.images.PDXObject xObjec
GraphicState inheritedGraphicState, COSObject parentStructElem, String parentsTags) {
ASAtom type = xObject.getType();
if (ASAtom.FORM.equals(type)) {
return new GFPDXForm((PDXForm) xObject, resources, inheritedGraphicState, parentStructElem, parentsTags, null, false);
return new GFPDXForm((PDXForm) xObject, resources, inheritedGraphicState, parentStructElem, parentsTags, null, false, false);
} 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 c12d963

Please sign in to comment.