public void setArrayKey(final ASAtom key, final int size, final COSObject[] value) { if (value != null && (this.base == null || !this.base.setArrayKey(key, size, value))) { COSObject obj = COSArray.construct(size, value); this.base = new COSDictionary(key, obj); } }
public void setArrayKey(final ASAtom key, final COSObject array) { if (array != null && (this.base == null || !this.base.setArrayKey(key, array))) { COSObject obj = COSArray.construct(); this.base = new COSDictionary(key, obj); } }
public void setArrayKey(final ASAtom key) { if (this.base == null || !this.base.setArrayKey(key)) { COSObject obj = COSArray.construct(); this.base = new COSDictionary(key, obj); } }
private void array() throws PostScriptException { try { COSObject arraySize = getTopNumber(); this.operandStack.push(COSArray.construct(arraySize.getInteger().intValue())); } catch (PostScriptException e) { throw new PostScriptException("Can't execute array operator", e); } }
public void setArrayKey(final ASAtom key, final int size, final double[] value) { if (value != null && (this.base == null || this.base.setArrayKey(key, size, value))) { COSObject obj = COSArray.construct(size, value); this.base = new COSDictionary(key, obj); } }
/** * This method makes sure that Index array is correctly initialized. * * @throws IOException */ private void initializeIndex() throws IOException { index = (COSArray) xrefCOSStream.getKey(ASAtom.INDEX).getDirectBase(); if (index == null) { COSObject[] defaultIndex = new COSObject[2]; defaultIndex[0] = COSInteger.construct(0); defaultIndex[1] = xrefCOSStream.getKey(ASAtom.SIZE); index = (COSArray) COSArray.construct(2, defaultIndex).getDirectBase(); } else if (index.size() % 2 != 0) { throw new IOException("Index array in xref stream has odd amount of elements."); } }
public List<PDAnnotation> getAnnotations() { COSObject annots = getKey(ASAtom.ANNOTS); if (!annots.empty() && annots.getType() == COSObjType.COS_ARRAY) { List<PDAnnotation> res = new ArrayList<>(); if (annots.isIndirect()) { annots = annots.getDirect(); } for (COSObject annot : (COSArray) annots.getDirectBase()) { if (annot != null && annot.getType() == COSObjType.COS_DICT) { res.add(new PDAnnotation(annot)); } } return Collections.unmodifiableList(res); } else if (annots.empty()) { annots = COSArray.construct(); this.setKey(ASAtom.ANNOTS, annots); } return Collections.emptyList(); }
protected COSObject getArray() throws IOException { if (this.flag) { nextToken(); } this.flag = true; final Token token = getToken(); if (token.type != Token.Type.TT_OPENARRAY) { return new COSObject(); } COSObject arr = COSArray.construct(); COSObject obj = nextObject(); while(!obj.empty()) { arr.add(obj); obj = nextObject(); } if (token.type != Token.Type.TT_CLOSEARRAY) { // TODO : replace with ASException throw new IOException("PDFParser::GetArray()" + StringExceptions.INVALID_PDF_ARRAY); } return arr; }
public void visitFromArray(COSArray obj) { this.copy.assign(COSArray.construct()); for (int i = 0; i < obj.size(); ++i) { COSObject element = new COSObject(); COSCopier copier = new COSCopier(element); obj.at(i).accept(copier); this.copy.add(element); } }
protected COSObject getArray() throws IOException { if (this.flag) { nextToken(); } this.flag = true; final Token token = getToken(); if (token.type != Token.Type.TT_OPENARRAY && !(isPSParser && token.type == Token.Type.TT_STARTPROC)) { return new COSObject(); } COSObject arr = COSArray.construct(); COSObject obj = nextObject(); while(!obj.empty()) { arr.add(obj); obj = nextObject(); } if (token.type != Token.Type.TT_CLOSEARRAY && !(isPSParser && token.type == Token.Type.TT_ENDPROC)) { // TODO : replace with ASException throw new IOException("PDFParser::GetArray()" + StringExceptions.INVALID_PDF_ARRAY); } return arr; }
protected void updateToObject() { COSObject branch = getObject(); COSObject kids = COSArray.construct(); for (PDPageTreeNode node : this.children) { kids.add(node.getObject()); } branch.setKey(ASAtom.KIDS, kids); COSObject count = COSInteger.construct(this.leafCount); branch.setKey(ASAtom.COUNT, count); PDPageTreeBranch parentNode = getParent(); if (parentNode != null) { branch.setKey(ASAtom.PARENT, parentNode.getObject()); } }