public PSLiteralObject(COSObject object) { super(object.get()); this.object = object; }
private static COSArray getProcessComponents(COSObject attributes) { COSObject process = attributes.getKey(ASAtom.PROCESS); if (!process.empty()) { COSObject components = process.getKey(ASAtom.COMPONENTS); if (!components.empty()) { return (COSArray) components.get(); } } return null; }
/** * @return the list of number tree nodes that are kids of this node or null * if no kids are present. */ public List<PDNumberTreeNode> getKids() { COSObject kids = this.getKey(ASAtom.KIDS); if (kids != null && !kids.empty() && kids.getType() == COSObjType.COS_ARRAY) { List<PDNumberTreeNode> res = new ArrayList<>(kids.size()); for (COSObject obj : (COSArray) kids.get()) { res.add(new PDNumberTreeNode(obj)); } return Collections.unmodifiableList(res); } return null; }
public COSBase get() { return this.child.get(); }
private static void addArrayElementsAsNumbers(List<CosNumber> list, COSArray base) { for (COSObject arg : base) { list.add(GFCosNumber.fromPDFParserNumber(arg.get())); } }
/** * Checks if attribute dict contains ActualText key and returns it's value. * * @return ActualText value or null if it is not present. */ public COSString getActualText() { COSObject actualText = getAttribute(ASAtom.ACTUAL_TEXT, COSObjType.COS_STRING); return actualText == null ? null : (COSString) actualText.get(); }
/** * Default constructor * @param dictionary greenfield COSDictionary */ public GFCosTrailer(COSDictionary dictionary) { super(dictionary, COS_TRAILER_TYPE); this.isEncrypted = dictionary.getKey(ASAtom.ENCRYPT).get() != null; }
private List<CosIndirect> getCatalog() { List<CosIndirect> result = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS); COSObject catalog = this.baseObject.getKey(ASAtom.ROOT); if (catalog.isIndirect().booleanValue()) { result.add(new GFCosIndirect((COSIndirect) catalog.get())); } else { LOGGER.log(Level.WARNING, "Catalog shall be an indirect reference"); } return Collections.unmodifiableList(result); }
/** * Get all values of the dictionary */ private List<CosObject> getValues() { List<CosObject> list = new ArrayList<>(this.baseObject.size().intValue()); for (COSObject value : this.baseObject.getValues()) { if (value != null) { list.add(getFromValue(value.get())); } } return Collections.unmodifiableList(list); }
public void parseTokens() throws IOException { Object token = parseNextToken(); while (token != null) { if (token instanceof COSObject) { token = ((COSObject) token).get(); } tokens.add(token); token = parseNextToken(); } }
private List<CosUnicodeName> getRoleMapNames() { if (this.simplePDObject != null) { Map<ASAtom, ASAtom> roleMap = ((org.verapdf.pd.structure.PDStructTreeRoot) simplePDObject).getRoleMap(); if (roleMap != null) { List<CosUnicodeName> res = new ArrayList<>(); for (Map.Entry<ASAtom, ASAtom> entry : roleMap.entrySet()) { res.add(new GFCosUnicodeName((COSName) COSName.construct(entry.getKey()).get())); res.add(new GFCosUnicodeName((COSName) COSName.construct(entry.getValue()).get())); } return res; } } return Collections.emptyList(); }
@Override public boolean equals(Object obj) { if(this == obj) { return true; } if(obj == null) { return false; } if(obj instanceof COSObject) { return this.equals(((COSObject) obj).get()); } List<COSBasePair> checkedObjects = new LinkedList<>(); return this.equals(obj, checkedObjects); }
@Override public boolean equals(Object obj) { if(this == obj) { return true; } if(obj == null) { return false; } if(obj instanceof COSObject) { return this.equals(((COSObject) obj).get()); } List<COSBasePair> checkedObjects = new LinkedList<>(); return this.equals(obj, checkedObjects); }
public GFCosIndirect(final COSKey key, final COSObject object) { super(object.get(), COS_INDIRECT_TYPE); this.isSpacingPDFACompliant = getspacingCompliesPDFA(object); this.id = GFIDGenerator.generateID(key); }
private Double getRequiredValue(final int position) { COSArray array = (COSArray) this.baseObject; if (array.size().intValue() > position) { COSBase base = array.at(position).get(); if (base instanceof COSNumber) { return base.getReal(); } LOGGER.log(Level.WARNING, "In bbox expected number but got " + base.getClass().getSimpleName()); } else { LOGGER.log(Level.WARNING, "Expected size of bbox array greater than" + position + "but got " + array.size()); } return null; }
/** * @return link to the name Object referenced by BaseFont key. */ private List<CosUnicodeName> getBaseFont() { String name = this.pdFont.getName(); if (name != null) { ArrayList<CosUnicodeName> list = new ArrayList<>(MAX_NUMBER_OF_ELEMENTS); list.add(new GFCosUnicodeName((COSName) COSName.construct(ASAtom.getASAtom(name)).get())); return Collections.unmodifiableList(list); } return Collections.emptyList(); }
/** * Constructs PD Type 0 font from font dictionary. * @param dictionary */ public PDType0Font(COSDictionary dictionary) { super(getDescendantCOSDictionary(dictionary)); type0FontDict = dictionary == null ? (COSDictionary) COSDictionary.construct().get() : dictionary; this.cMap = getCMap().getCMapFile(); }
public void visitFromStream(COSStream obj) { visitFromDictionary(obj); this.copy.assign(COSStream.construct((COSDictionary) this.copy.get(), obj.getData(), obj.getFilterFlags())); }