/** * @return COSObject representing indirect reference to digital signature * contained in this signature field. */ public COSObject getSignatureReference() { return this.getObject().getKey(ASAtom.V); } }
private Map<ASAtom, PDCryptFilter> getCryptFilters() { HashMap<ASAtom, PDCryptFilter> res = new HashMap<>(); COSObject cf = getKey(ASAtom.CF); if (cf == null || cf.getType() != COSObjType.COS_DICT) { return res; } Set<ASAtom> filters = cf.getKeySet(); for (ASAtom filterName : filters) { res.put(filterName, new PDCryptFilter(cf.getKey(filterName))); } return res; }
private COSObject getResource(ASAtom type, ASAtom name) { COSObject dict = getKey(type); if (dict != null) { return dict.getKey(name); } return null; }
public double[] getMatrix() { double[] res = TypeConverter.getRealArray(this.dictionary.getKey(ASAtom.MATRIX), 9, "Matrix"); return res != null ? res : new double[]{1, 0, 0, 0, 1, 0, 0, 0, 1}; } }
public double[] getRange() { double[] res = TypeConverter.getRealArray(this.dictionary.getKey(ASAtom.RANGE), 4, "Range"); return res != null ? res : new double[]{-100, 100, -100, 100}; } }
/** * @return COSObject of the referenced cMap. */ public COSObject getUseCMap() { COSObject res = this.getObject().getKey(ASAtom.USE_CMAP); return res == null ? COSObject.getEmpty() : res; }
@Override public InputStream getJBIG2Global() { COSObject globals = base.getKey(ASAtom.JBIG2_GLOBALS); if (globals.getType() == COSObjType.COS_STREAM) { return globals.getData(COSStream.FilterFlags.DECODE); } return null; }
private static ASAtom getFieldTypeCOSObject(COSObject field) { ASAtom res = field.getNameKey(ASAtom.FT); if (res != null) { return res; } COSObject parent = field.getKey(ASAtom.PARENT); if (parent != null) { return getFieldTypeCOSObject(parent); } return null; } }
public PDColorSpace getColorSpace() { COSObject obj = getObject().getKey(ASAtom.COLORSPACE); if (obj != null && !obj.empty()) { return ColorSpaceFactory.getColorSpace(obj, this.resources, false); } LOGGER.log(Level.FINE,"Shading object do not contain required key ColorSpace"); return null; }
/** * @return digital signature contained in this signature field, or null if * digital signature can't be obtained. */ public PDSignature getSignature() { COSDictionary sigDict = (COSDictionary) this.getObject().getKey(ASAtom.V).getDirectBase(); return sigDict == null ? null : new PDSignature(sigDict); }
public PDPageTree getPageTree() { if (pages.empty()) { final COSObject pages = super.getObject().getKey(ASAtom.PAGES); if (pages != null) { this.pages.setObject(pages); } } return pages; }
@Override public String getdestOutputProfileIndirect() { COSObject obj = simplePDObject.getKey(ASAtom.DEST_OUTPUT_PROFILE); if (!obj.empty() && obj.isIndirect().booleanValue()) { COSKey key = obj.getKey(); return String.valueOf(key.getNumber() + " " + key.getGeneration()); } return null; }
protected COSObject getInheritableResources() { COSObject value = getObject().getKey(ASAtom.RESOURCES); if (value != null && !value.empty()) { return value; } if (parent != null) { return parent.getInheritableResources(); } return null; }
private PDAppearanceEntry getAppearanceEntry(ASAtom key) { COSObject appearanceDictionary = getCOSAP(); if (appearanceDictionary != null) { COSObject appearance = appearanceDictionary.getKey(key); if (appearance != null && appearance.getType().isDictionaryBased()) { return new PDAppearanceEntry(appearance); } } return null; }
private PDResourcesHandler getResourcesFromCharProcs(COSObject charProcs) { if (!charProcs.knownKey(ASAtom.RESOURCES)) { return null; } PDResources res = new PDResources(charProcs.getKey(ASAtom.RESOURCES)); return PDResourcesHandler.getInstance(this.resources.getPageResources(), res); } }
private static void registerDictionaryAFKeys(COSObject dictionary) { if (dictionary == null || !(dictionary.getType().isDictionaryBased())) { return; } COSObject af = dictionary.getKey(ASAtom.AF); if (af != null && af.getType() == COSObjType.COS_ARRAY) { registerFileSpecificationKeys((COSArray) af.getDirectBase()); } }
private static void processFont(PDFont font) { if (font != null && !isKeyVisited(font.getObject().getKey()) && ASAtom.TYPE3.equals(font.getSubtype())) { parseResources(((PDType3Font) font).getResources()); } }
public COSKey setObject(COSObject obj) { COSKey key = obj.getKey(); //TODO : fix this method for document save if (key == null) { key = this.xref.next(); this.body.set(key, obj.isIndirect() ? obj.getDirect() : obj); obj = COSIndirect.construct(key, this); } this.xref.newKey(key); return key; }
private void initializeContents(final COSObject pageDict) { COSObject contents = pageDict.getKey(ASAtom.CONTENTS); if (!contents.empty() && contents.getType() == COSObjType.COS_STREAM) { this.content = new PDPageContentStream(contents); } else if (!contents.empty() && contents.getType() == COSObjType.COS_ARRAY) { try { this.content = new PDPageContentStream(COSStream.concatenateStreams((COSArray) contents.getDirectBase())); } catch (IOException e) { this.content = new PDPageContentStream(contents.at(0)); } } }