/** * Constructs a <CODE>PdfDictionary</CODE>-object of a certain type. * * @param type a <CODE>PdfName</CODE> */ public PdfDictionary(final PdfName type) { this(); dictionaryType = type; put(PdfName.TYPE, dictionaryType); }
private static PdfDictionary createBuiltInFontDictionary(PdfName name) { if (name == null) { return null; } PdfDictionary dictionary = new PdfDictionary(); dictionary.put(PdfName.TYPE, PdfName.FONT); dictionary.put(PdfName.BASEFONT, name); dictionary.put(PdfName.SUBTYPE, PdfName.TYPE1); return dictionary; }
/** * Generations the developer extension dictionary corresponding * with the prefix. * @return a PdfDictionary */ public PdfDictionary getDeveloperExtensions() { PdfDictionary developerextensions = new PdfDictionary(); developerextensions.put(PdfName.BASEVERSION, baseversion); developerextensions.put(PdfName.EXTENSIONLEVEL, new PdfNumber(extensionLevel)); return developerextensions; } }
/** * Adds or replaces the Collection Dictionary in the Catalog. * * @param collection the new collection dictionary. */ void makePackage(PdfCollection collection) { PdfDictionary catalog = reader.getCatalog(); catalog.put(PdfName.COLLECTION, collection); }
PdfName addFont(PdfName name, PdfIndirectReference reference) { name = translateName(name); fontDictionary.put(name, reference); return name; }
PdfName addShading(PdfName name, PdfIndirectReference reference) { name = translateName(name); shadingDictionary.put(name, reference); return name; }
/** * Indicates that the group should be set to that state when the * document is opened in a viewer application. * @param view the view state */ public void setView(boolean view) { PdfDictionary usage = getUsage(); PdfDictionary dic = new PdfDictionary(); dic.put(PdfName.VIEWSTATE, view ? PdfName.ON : PdfName.OFF); usage.put(PdfName.VIEW, dic); }
private PdfDictionary getFontBaseType(PdfIndirectReference CIDFont) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.SUBTYPE, PdfName.TYPE0); String name = fontName; if (style.length() > 0) name += "-" + style.substring(1); name += "-" + CMap; dic.put(PdfName.BASEFONT, new PdfName(name)); dic.put(PdfName.ENCODING, new PdfName(CMap)); dic.put(PdfName.DESCENDANTFONTS, new PdfArray(CIDFont)); return dic; }
PdfName addXObject(PdfName name, PdfIndirectReference reference) { name = translateName(name); xObjectDictionary.put(name, reference); return name; }
void setPageAction(final PdfName actionType, final PdfAction action) { if (pageAA == null) { pageAA = new PdfDictionary(); } pageAA.put(actionType, action); }
protected void writeOutlines(final PdfDictionary catalog, final boolean namedAsNames) throws IOException { if (newBookmarks == null || newBookmarks.isEmpty()) return; PdfDictionary top = new PdfDictionary(); PdfIndirectReference topRef = getPdfIndirectReference(); Object kids[] = SimpleBookmark.iterateOutlines(this, topRef, newBookmarks, namedAsNames); top.put(PdfName.FIRST, (PdfIndirectReference)kids[0]); top.put(PdfName.LAST, (PdfIndirectReference)kids[1]); top.put(PdfName.COUNT, new PdfNumber(((Integer)kids[2]).intValue())); addToBody(top, topRef); catalog.put(PdfName.OUTLINES, topRef); }
void readPages() throws IOException { if (refsn != null) return; refsp = null; refsn = new ArrayList<PRIndirectReference>(); pageInh = new ArrayList<PdfDictionary>(); iteratePages((PRIndirectReference)reader.catalog.get(PdfName.PAGES)); pageInh = null; reader.rootPages.put(PdfName.COUNT, new PdfNumber(refsn.size())); }
public static PdfShading type3(PdfWriter writer, BaseColor colorSpace, float coords[], float domain[], PdfFunction function, boolean extend[]) { PdfShading sp = type2(writer, colorSpace, coords, domain, function, extend); sp.shadingType = 3; sp.shading.put(PdfName.SHADINGTYPE, new PdfNumber(sp.shadingType)); return sp; }
public void setAppearance(PdfName ap, PdfTemplate template) { PdfDictionary dic = (PdfDictionary)get(PdfName.AP); if (dic == null) dic = new PdfDictionary(); dic.put(ap, template.getIndirectReference()); put(PdfName.AP, dic); if (!form) return; if (templates == null) templates = new HashSet<PdfTemplate>(); templates.add(template); }
void addAdditionalAction(final PdfName actionType, final PdfAction action) { if (additionalActions == null) { additionalActions = new PdfDictionary(); } if (action == null) additionalActions.remove(actionType); else additionalActions.put(actionType, action); if (additionalActions.size() == 0) additionalActions = null; }
public void setMKBackgroundColor(BaseColor color) { if (color == null) getMK().remove(PdfName.BG); else getMK().put(PdfName.BG, getMKColor(color)); }
public void setAdditionalActions(PdfName key, PdfAction action) { PdfDictionary dic; PdfObject obj = get(PdfName.AA); if (obj != null && obj.isDictionary()) dic = (PdfDictionary)obj; else dic = new PdfDictionary(); dic.put(key, action); put(PdfName.AA, dic); }
public void setMKBorderColor(BaseColor color) { if (color == null) getMK().remove(PdfName.BC); else getMK().put(PdfName.BC, getMKColor(color)); }
private static void clearSigDic(PdfDictionary dic) { dic.remove(PdfName.AP); dic.remove(PdfName.AS); dic.remove(PdfName.V); dic.remove(PdfName.DV); dic.remove(PdfName.SV); dic.remove(PdfName.FF); dic.put(PdfName.F, new PdfNumber(PdfAnnotation.FLAGS_PRINT)); }