protected PDCIEDictionaryBased() { this(COSDictionary.construct()); }
public COSTrailer() { super(); setObject(COSDictionary.construct(), false); }
protected PDCIEDictionaryBased(COSObject obj) { super(obj); COSObject dict = obj.at(1); this.dictionary = (dict == null || !(dict.getType() == COSObjType.COS_DICT)) ? COSDictionary.construct() : dict; }
public void visitFromDictionary(COSDictionary obj) { this.copy.assign(COSDictionary.construct()); for (Map.Entry<ASAtom, COSObject> entry : obj.getEntrySet()) { COSObject element = new COSObject(); COSCopier copier = new COSCopier(element); entry.getValue().accept(copier); this.copy.setKey(entry.getKey(), element); } }
public PDResources getResources() { COSObject res = getKey(ASAtom.RESOURCES); if (res != null && res.getType() == COSObjType.COS_DICT) { return new PDResources(res); } return new PDResources(COSDictionary.construct()); }
/** * 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 PDResources getResources() { COSObject resources = getKey(ASAtom.RESOURCES); if (resources != null && resources.getType() == COSObjType.COS_DICT) { return new PDResources(resources); } return new PDResources(COSDictionary.construct()); }
COSObjType paramsType = decodeParams.at(i).getType(); if (decodeParams.at(i).empty() || paramsType == COSObjType.COS_NULL) { decodeParameters.add((COSDictionary) COSDictionary.construct().get()); } else if (paramsType != COSObjType.COS_DICT) { throw new IOException("DecodeParams shall be a dictionary or array of dictionaries."); decodeParameters = new ArrayList<>(entries.size()); for(int i = 0; i < entries.size(); ++i) { decodeParameters.add((COSDictionary) COSDictionary.construct().get());
private void initialize() { COSObject dict = COSDictionary.construct(); dict.setNameKey(ASAtom.TYPE, ASAtom.PAGES); dict.setArrayKey(ASAtom.KIDS); dict.setIntegerKey(ASAtom.COUNT, 0); COSObject branch = COSIndirect.construct(dict); setObject(branch); }
public PDPage(final double bbox[], final COSDocument document) { super(); this.pageNumber = 0; this.pagesTotal = 0; final COSObject page = COSDictionary.construct(); page.setNameKey(ASAtom.TYPE, ASAtom.PAGE); page.setArrayKey(ASAtom.MEDIA_BOX, 4, bbox); page.setArrayKey(ASAtom.CONTENTS); final COSObject indirect = COSIndirect.construct(page, document); this.setObject(indirect); }
/** * Constructor from COSDictionary. * * @param dictionary is font dictionary. */ public PDFont(COSDictionary dictionary) { super(new COSObject(dictionary)); if (dictionary == null) { dictionary = (COSDictionary) COSDictionary.construct().get(); } this.dictionary = dictionary; COSObject fd = dictionary.getKey(ASAtom.FONT_DESC); if (fd != null && fd.getType() == COSObjType.COS_DICT) { fontDescriptor = new PDFontDescriptor(fd); } else { fontDescriptor = new PDFontDescriptor(COSDictionary.construct()); } this.fontName = this.dictionary.getStringKey(ASAtom.BASE_FONT); this.subtype = this.dictionary.getNameKey(ASAtom.SUBTYPE); }
private List<PDOCConfig> getD() { List<PDOCConfig> result = new ArrayList<>(); COSObject contentProperties = this.simplePDObject.getObject(); if (contentProperties.getType() == COSObjType.COS_DICT) { COSObject defaultConfig = contentProperties.getKey(ASAtom.D); if (!defaultConfig.empty() && defaultConfig.getType() == COSObjType.COS_DICT) { String[] groupNames = ((PDOptionalContentProperties) this.simplePDObject).getGroupNames(); List<String> groupNamesList = Arrays.asList(groupNames == null ? new String[]{} : groupNames); PDOCConfig pdConfig = new GFPDOCConfig(new PDObject(defaultConfig), groupNamesList, false); result.add(pdConfig); return result; } } else { LOGGER.log(Level.SEVERE, "Invalid object type of the default optional configuration dictionary. Returning empty config."); PDOCConfig config = new GFPDOCConfig(new PDObject(COSDictionary.construct())); result.add(config); return result; } return result; }
operandStack.push(COSDictionary.construct()); break; case "begin":
/** * @return resources as presented in type 3 font dictionary. */ public PDResources getResources() { COSObject resources = this.dictionary.getKey(ASAtom.RESOURCES); if (!resources.empty() && resources.getType() == COSObjType.COS_DICT) { if (resources.isIndirect()) { resources = resources.getDirect(); } return new PDResources(resources); } else { return new PDResources(COSDictionary.construct()); } }
protected COSObject getDictionary() throws IOException { if (this.flag) { nextToken(); } this.flag = true; final Token token = getToken(); if (token.type != Token.Type.TT_OPENDICT) { return new COSObject(); } COSObject dict = COSDictionary.construct(); COSObject key = getName(); while (!key.empty()) { COSObject obj = nextObject(); dict.setKey(key.getName(), obj); key = getName(); } if (token.type != Token.Type.TT_CLOSEDICT) { // TODO : replace with ASException throw new IOException("PDFParser::GetDictionary()" + StringExceptions.INVALID_PDF_DICTONARY); } // Don't parse COSStreams here. return dict; }
COSObject dict = COSDictionary.construct();
if (result instanceof InlineImageOperator) { InlineImageOperator imageOperator = (InlineImageOperator) result; COSDictionary imageParameters = (COSDictionary) COSDictionary.construct().get(); lastInlineImageDict = imageParameters; imageOperator.setImageParameters(imageParameters);
private COSDictionary getCIDSystemInfo() { if (this.getObject().getType() == COSObjType.COS_NAME) { // actually creating COSDictionary with values from predefined CMap. String registry = this.getCMapFile().getRegistry(); String ordering = this.getCMapFile().getOrdering(); int supplement = this.getCMapFile().getSupplement(); COSDictionary res = (COSDictionary) COSDictionary.construct(ASAtom.REGISTRY, registry).get(); res.setStringKey(ASAtom.ORDERING, ordering); res.setIntegerKey(ASAtom.SUPPLEMENT, supplement); return res; } if (cidSystemInfo == null) { COSObject cidSystemInfoObject = this.getObject().getKey(ASAtom.CID_SYSTEM_INFO); if (cidSystemInfoObject.getType() == COSObjType.COS_DICT) { this.cidSystemInfo = (COSDictionary) cidSystemInfoObject.getDirectBase(); } else if (cidSystemInfoObject.getType() == COSObjType.COS_ARRAY) { // see PDF-1.4 specification cidSystemInfoObject = cidSystemInfoObject.at(0); if (cidSystemInfoObject != null && cidSystemInfoObject.getType() == COSObjType.COS_DICT) { this.cidSystemInfo = (COSDictionary) cidSystemInfoObject.getDirectBase(); } } } return this.cidSystemInfo; }