Skip to content

Commit

Permalink
Merge pull request #325 from veraPDF/pdfua2
Browse files Browse the repository at this point in the history
PDF/UA-2. Add new methods.
  • Loading branch information
MaximPlusov authored Oct 20, 2023
2 parents 1f92ead + 0925598 commit 8f77b35
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
import org.verapdf.model.baselayer.Object;
import org.verapdf.model.coslayer.CosBM;
import org.verapdf.model.coslayer.CosLang;
import org.verapdf.model.coslayer.CosNumber;
import org.verapdf.model.impl.pb.cos.PBCosBM;
import org.verapdf.model.impl.pb.cos.PBCosLang;
import org.verapdf.model.impl.pb.cos.PBCosNumber;
import org.verapdf.model.impl.pb.pd.actions.PBoxPDAction;
import org.verapdf.model.impl.pb.pd.actions.PBoxPDAnnotationAdditionalActions;
import org.verapdf.model.impl.pb.pd.annotations.PBoxPD3DAnnot;
Expand Down Expand Up @@ -364,10 +362,6 @@ public List<? extends Object> getLinkedObjects(String link) {
return this.getAdditionalActions();
case A:
return this.getA();
case IC:
return this.getIC();
case C:
return this.getC();
case APPEARANCE:
return this.getAppearance();
case LANG:
Expand Down Expand Up @@ -427,28 +421,6 @@ private List<PDAction> getA() {
return Collections.emptyList();
}

private List<CosNumber> getIC() {
return this.getNumbersFromArray(COSName.IC);
}

private List<CosNumber> getC() {
return this.getNumbersFromArray(COSName.C);
}

private List<CosNumber> getNumbersFromArray(COSName arrayName) {
COSBase colorArray = ((PDAnnotation) this.simplePDObject).getCOSObject().getDictionaryObject(arrayName);
if (colorArray instanceof COSArray) {
List<CosNumber> color = new ArrayList<>(((COSArray) colorArray).size());
for (COSBase colorValue : (COSArray) colorArray) {
if (colorValue instanceof COSNumber) {
color.add(PBCosNumber.fromPDFBoxNumber(colorValue));
}
}
return Collections.unmodifiableList(color);
}
return Collections.emptyList();
}

/**
* @return normal appearance stream (N key in the appearance dictionary) of
* the annotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ public Boolean getcircularMappingExist() {
return null;
}

@Override
public String getroleMapToSameNamespaceTag() {
return null;
}

@Override
public List<? extends Object> getLinkedObjects(String link) {
switch (link) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,9 @@ public String gettopLevelFirstElementStandardType() {
}
return null;
}

@Override
public String getfirstChildStandardTypeNamespaceURL() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ public class PBoxPDCIDFont extends PBoxPDFont implements PDCIDFont {

public static final String CID_FONT_TYPE = "PDCIDFont";

public static final String CID_SET = "CIDSet";

public static final String IDENTITY = "Identity";
public static final String CUSTOM = "Custom";

Expand Down Expand Up @@ -121,24 +119,6 @@ public Boolean getcidSetListsAllGlyphs() {
return Boolean.TRUE;
}

@Override
public List<? extends Object> getLinkedObjects(String link) {
if (CID_SET.equals(link)) {
return this.getCIDSet();
}
return super.getLinkedObjects(link);
}

private List<CosStream> getCIDSet() {
PDStream cidSet = getCIDSetStream();
if (cidSet != null) {
List<CosStream> res = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS);
res.add(new PBCosStream(cidSet.getStream(), this.pdDocument, this.flavour));
return Collections.unmodifiableList(res);
}
return Collections.emptyList();
}

private PDStream getCIDSetStream() {
PDFontDescriptor fontDescriptor = this.pdFontLike.getFontDescriptor();
PDStream cidSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,9 @@ public PBoxSEFENote(COSDictionary structElemDictionary, TaggedPDFRoleMapHelper r
public String getNoteType() {
return null;
}

@Override
public String getorphanRefs() {
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,6 @@ public void testActionLink() {
}
}

@Test
public void testICLink() {
List<? extends Object> action = actual.getLinkedObjects(PBoxPDAnnot.IC);
Assert.assertEquals(0, action.size());
for (Object object : action) {
Assert.assertEquals(PBCosReal.COS_REAL_TYPE, object.getObjectType());
}
}

@Test
public void testCLink() {
List<? extends Object> action = actual.getLinkedObjects(PBoxPDAnnot.C);
Assert.assertEquals(0, action.size());
for (Object object : action) {
Assert.assertEquals(PBCosReal.COS_REAL_TYPE, object.getObjectType());
}
}

@Test
public void testAppearanceLink() {
List<? extends Object> action = actual.getLinkedObjects(PBoxPDAnnot.APPEARANCE);
Expand Down

0 comments on commit 8f77b35

Please sign in to comment.