/** * Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS. * (Contributed by Kazuya Ujihara) * @param indirect * 2004-06-13 */ private static int getNumber(PdfIndirectReference indirect) { PdfDictionary pdfObj = (PdfDictionary)PdfReader.getPdfObjectRelease(indirect); if (pdfObj.contains(PdfName.TYPE) && pdfObj.get(PdfName.TYPE).equals(PdfName.PAGES) && pdfObj.contains(PdfName.KIDS)) { PdfArray kids = (PdfArray)pdfObj.get(PdfName.KIDS); indirect = (PdfIndirectReference)kids.getPdfObject(0); } return indirect.getNumber(); }
/** * Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS. * (Contributed by Kazuya Ujihara) * @param indirect * 2004-06-13 */ private static int getNumber(PdfIndirectReference indirect) { PdfDictionary pdfObj = (PdfDictionary)PdfReader.getPdfObjectRelease(indirect); if (pdfObj.contains(PdfName.TYPE) && pdfObj.get(PdfName.TYPE).equals(PdfName.PAGES) && pdfObj.contains(PdfName.KIDS)) { PdfArray kids = (PdfArray)pdfObj.get(PdfName.KIDS); indirect = (PdfIndirectReference)kids.getPdfObject(0); } return indirect.getNumber(); }
/** * Gets number of indirect. If type of directed indirect is PAGES, it refers PAGE object through KIDS. * (Contributed by Kazuya Ujihara) * @param indirect * 2004-06-13 */ private static int getNumber(PdfIndirectReference indirect) { PdfDictionary pdfObj = (PdfDictionary)PdfReader.getPdfObjectRelease(indirect); if (pdfObj.contains(PdfName.TYPE) && pdfObj.get(PdfName.TYPE).equals(PdfName.PAGES) && pdfObj.contains(PdfName.KIDS)) { PdfArray kids = (PdfArray)pdfObj.get(PdfName.KIDS); indirect = (PdfIndirectReference)kids.getPdfObject(0); } return indirect.getNumber(); }
Integer key = numbers[k]; PdfDictionary d = (PdfDictionary)PdfReader.getPdfObjectRelease((PdfObject)numberTree.get(key)); if (d.contains(PdfName.ST)) { pagecount = ((PdfNumber)d.get(PdfName.ST)).intValue(); } else { pagecount = 1; if (d.contains(PdfName.P)) { prefix = ((PdfString)d.get(PdfName.P)).toUnicodeString(); } else { prefix = ""; if (d.contains(PdfName.S)) { char type = ((PdfName)d.get(PdfName.S)).toString().charAt(1); switch(type) {
Integer key = numbers[k]; PdfDictionary d = (PdfDictionary)PdfReader.getPdfObjectRelease((PdfObject)numberTree.get(key)); if (d.contains(PdfName.ST)) { pagecount = ((PdfNumber)d.get(PdfName.ST)).intValue(); } else { pagecount = 1; if (d.contains(PdfName.P)) { prefix = ((PdfString)d.get(PdfName.P)).toUnicodeString(); } else { prefix = ""; if (d.contains(PdfName.S)) { char type = ((PdfName)d.get(PdfName.S)).toString().charAt(1); switch(type) {
if (numberTree.containsKey(current)) { PdfDictionary d = (PdfDictionary)PdfReader.getPdfObjectRelease((PdfObject)numberTree.get(current)); if (d.contains(PdfName.ST)) { pagecount = ((PdfNumber)d.get(PdfName.ST)).intValue(); pagecount = 1; if (d.contains(PdfName.P)) { prefix = ((PdfString)d.get(PdfName.P)).toUnicodeString(); if (d.contains(PdfName.S)) { type = ((PdfName)d.get(PdfName.S)).toString().charAt(1);
if (numberTree.containsKey(current)) { PdfDictionary d = (PdfDictionary)PdfReader.getPdfObjectRelease((PdfObject)numberTree.get(current)); if (d.contains(PdfName.ST)) { pagecount = ((PdfNumber)d.get(PdfName.ST)).intValue(); pagecount = 1; if (d.contains(PdfName.P)) { prefix = ((PdfString)d.get(PdfName.P)).toUnicodeString(); if (d.contains(PdfName.S)) { type = ((PdfName)d.get(PdfName.S)).toString().charAt(1);
if (numberTree.containsKey(current)) { PdfDictionary d = (PdfDictionary) PdfReader.getPdfObjectRelease((PdfObject) numberTree.get(current)); if (d.contains(PdfName.ST)) { pagecount = ((PdfNumber) d.get(PdfName.ST)).intValue(); } else { pagecount = 1; if (d.contains(PdfName.P)) { prefix = ((PdfString) d.get(PdfName.P)).toUnicodeString(); } else { prefix = ""; if (d.contains(PdfName.S)) { type = d.get(PdfName.S).toString() .charAt(1);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
dr.put(PdfName.FONT, fonts); if (!fonts.contains(PdfName.HELV)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.HELVETICA); fonts.put(PdfName.HELV, addToBody(dic).getIndirectReference()); if (!fonts.contains(PdfName.ZADB)) { PdfDictionary dic = new PdfDictionary(PdfName.FONT); dic.put(PdfName.BASEFONT, PdfName.ZAPFDINGBATS);
void addDocumentField(PdfIndirectReference ref) { PdfDictionary catalog = reader.getCatalog(); PdfDictionary acroForm = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), catalog); if (acroForm == null) { acroForm = new PdfDictionary(); catalog.put(PdfName.ACROFORM, acroForm); markUsed(catalog); } PdfArray fields = (PdfArray)PdfReader.getPdfObject(acroForm.get(PdfName.FIELDS), acroForm); if (fields == null) { fields = new PdfArray(); acroForm.put(PdfName.FIELDS, fields); markUsed(acroForm); } if (!acroForm.contains(PdfName.DA)) { acroForm.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); markUsed(acroForm); } fields.add(ref); markUsed(fields); }
void addDocumentField(PdfIndirectReference ref) { PdfDictionary catalog = reader.getCatalog(); PdfDictionary acroForm = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), catalog); if (acroForm == null) { acroForm = new PdfDictionary(); catalog.put(PdfName.ACROFORM, acroForm); markUsed(catalog); } PdfArray fields = (PdfArray)PdfReader.getPdfObject(acroForm.get(PdfName.FIELDS), acroForm); if (fields == null) { fields = new PdfArray(); acroForm.put(PdfName.FIELDS, fields); markUsed(acroForm); } if (!acroForm.contains(PdfName.DA)) { acroForm.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); markUsed(acroForm); } fields.add(ref); markUsed(fields); }
void addDocumentField(PdfIndirectReference ref) { PdfDictionary catalog = this.reader.getCatalog(); PdfDictionary acroForm = (PdfDictionary)PdfReader.getPdfObject(catalog.get(PdfName.ACROFORM), catalog); if (acroForm == null) { acroForm = new PdfDictionary(); catalog.put(PdfName.ACROFORM, acroForm); markUsed(catalog); } PdfArray fields = (PdfArray)PdfReader.getPdfObject(acroForm.get(PdfName.FIELDS), acroForm); if (fields == null) { fields = new PdfArray(); acroForm.put(PdfName.FIELDS, fields); markUsed(acroForm); } if (!acroForm.contains(PdfName.DA)) { acroForm.put(PdfName.DA, new PdfString("/Helv 0 Tf 0 g ")); markUsed(acroForm); } fields.add(ref); markUsed(fields); }
/** * Writes a <CODE>PdfImage</CODE> to the outputstream. * * @param pdfImage the image to be added * @return a <CODE>PdfIndirectReference</CODE> to the encapsulated image * @throws PdfException when a document isn't open yet, or has been closed */ PdfIndirectReference add(PdfImage pdfImage, PdfIndirectReference fixedRef) throws PdfException { if (! imageDictionary.contains(pdfImage.name())) { PdfXConformanceImp.checkPDFXConformance(this, PdfXConformanceImp.PDFXKEY_IMAGE, pdfImage); if (fixedRef instanceof PRIndirectReference) { PRIndirectReference r2 = (PRIndirectReference)fixedRef; fixedRef = new PdfIndirectReference(0, getNewObjectNumber(r2.getReader(), r2.getNumber(), r2.getGeneration())); } try { if (fixedRef == null) fixedRef = addToBody(pdfImage).getIndirectReference(); else addToBody(pdfImage, fixedRef); } catch(IOException ioe) { throw new ExceptionConverter(ioe); } imageDictionary.put(pdfImage.name(), fixedRef); return fixedRef; } return (PdfIndirectReference) imageDictionary.get(pdfImage.name()); }
/** * Writes a <CODE>PdfImage</CODE> to the outputstream. * * @param pdfImage the image to be added * @return a <CODE>PdfIndirectReference</CODE> to the encapsulated image * @throws PdfException when a document isn't open yet, or has been closed */ PdfIndirectReference add(PdfImage pdfImage, PdfIndirectReference fixedRef) throws PdfException { if (! imageDictionary.contains(pdfImage.name())) { PdfXConformanceImp.checkPDFXConformance(this, PdfXConformanceImp.PDFXKEY_IMAGE, pdfImage); if (fixedRef instanceof PRIndirectReference) { PRIndirectReference r2 = (PRIndirectReference)fixedRef; fixedRef = new PdfIndirectReference(0, getNewObjectNumber(r2.getReader(), r2.getNumber(), r2.getGeneration())); } try { if (fixedRef == null) fixedRef = addToBody(pdfImage).getIndirectReference(); else addToBody(pdfImage, fixedRef); } catch(IOException ioe) { throw new ExceptionConverter(ioe); } imageDictionary.put(pdfImage.name(), fixedRef); return fixedRef; } return (PdfIndirectReference) imageDictionary.get(pdfImage.name()); }
/** * Writes a <CODE>PdfImage</CODE> to the outputstream. * * @param pdfImage the image to be added * @return a <CODE>PdfIndirectReference</CODE> to the encapsulated image * @throws PdfException when a document isn't open yet, or has been closed */ PdfIndirectReference add(PdfImage pdfImage, PdfIndirectReference fixedRef) throws PdfException { if (! imageDictionary.contains(pdfImage.name())) { PdfXConformanceImp.checkPDFXConformance(this, PdfXConformanceImp.PDFXKEY_IMAGE, pdfImage); if (fixedRef instanceof PRIndirectReference) { PRIndirectReference r2 = (PRIndirectReference)fixedRef; fixedRef = new PdfIndirectReference(0, getNewObjectNumber(r2.getReader(), r2.getNumber(), r2.getGeneration())); } try { if (fixedRef == null) fixedRef = addToBody(pdfImage).getIndirectReference(); else addToBody(pdfImage, fixedRef); } catch(IOException ioe) { throw new ExceptionConverter(ioe); } imageDictionary.put(pdfImage.name(), fixedRef); return fixedRef; } return (PdfIndirectReference) imageDictionary.get(pdfImage.name()); }