public PRIndirectReference findNamedFont( PdfReader myReader, String desiredFontName) { int objNum = 0; PdfObject curObj; do { //The "Release" version doesn't keep a reference //to the object so it can be GC'd later. Quite Handy //when dealing with Really Big PDFs. curObj = myReader.getPdfObjectRelease( objNum++ ); if (curObj instanceof PRStream) { PRStream stream = (PRStream)curObj; PdfName type = stream.getAsName(PdfName.TYPE); if (PdfName.FONT.equals(type)) { PdfString fontName = stream.getAsString(PdfName.BASEFONT); if (desiredFontName.equals(fontName.toString())) { return curObj.getIndRef(); } } } } while (curObj != null); return null; }
protected void markUsed(PdfObject obj) { if (append && obj != null) { PRIndirectReference ref = null; if (obj.type() == PdfObject.INDIRECT) ref = (PRIndirectReference) obj; else ref = obj.getIndRef(); if (ref != null) marked.put(ref.getNumber(), 1); } }
protected void markUsed(PdfObject obj) { if (append && obj != null) { PRIndirectReference ref = null; if (obj.type() == PdfObject.INDIRECT) ref = (PRIndirectReference) obj; else ref = obj.getIndRef(); if (ref != null) marked.put(ref.getNumber(), 1); } }
/** * @param obj * @param parent * @return a PdfObject */ public static PdfObject getPdfObject(PdfObject obj, final PdfObject parent) { if (obj == null) return null; if (!obj.isIndirect()) { PRIndirectReference ref = null; if (parent != null && (ref = parent.getIndRef()) != null && ref.getReader().isAppendable()) { switch (obj.type()) { case PdfObject.NULL: obj = new PdfNull(); break; case PdfObject.BOOLEAN: obj = new PdfBoolean(((PdfBoolean)obj).booleanValue()); break; case PdfObject.NAME: obj = new PdfName(obj.getBytes()); break; } obj.setIndRef(ref); } return obj; } return getPdfObject(obj); }
/** * @param obj * @param parent * @return a PdfObject */ public static PdfObject getPdfObject(PdfObject obj, final PdfObject parent) { if (obj == null) return null; if (!obj.isIndirect()) { PRIndirectReference ref = null; if (parent != null && (ref = parent.getIndRef()) != null && ref.getReader().isAppendable()) { switch (obj.type()) { case PdfObject.NULL: obj = new PdfNull(); break; case PdfObject.BOOLEAN: obj = new PdfBoolean(((PdfBoolean)obj).booleanValue()); break; case PdfObject.NAME: obj = new PdfName(obj.getBytes()); break; } obj.setIndRef(ref); } return obj; } return getPdfObject(obj); }
PdfObject destOutputIntent = dictionary.get(PdfName.DESTOUTPUTPROFILE); if (destOutputIntent != null && pdfaDestOutputIntent != null) { if (pdfaDestOutputIntent.getIndRef() != destOutputIntent.getIndRef()) throw new PdfAConformanceException(obj1, MessageLocalization.getComposedMessage("if.outputintents.array.more.than.one.entry.the.same.indirect.object")); } else {
body.add(xmp, xmpo.getIndRef()); } else { catalog.put(PdfName.METADATA, body.add(xmp).getIndirectReference());
body.add(xmp, xmpo.getIndRef()); } else { catalog.put(PdfName.METADATA, body.add(xmp).getIndirectReference());
PdfObject destOutputIntent = dictionary.get(PdfName.DESTOUTPUTPROFILE); if (destOutputIntent != null && pdfaDestOutputIntent != null) { if (pdfaDestOutputIntent.getIndRef() != destOutputIntent.getIndRef()) throw new PdfAConformanceException(obj1, MessageLocalization.getComposedMessage("if.outputintents.array.more.than.one.entry.the.same.indirect.object")); } else {
PdfObject obj = reader.getPdfObjectRelease(j); if (obj != null && skipInfo != j && j < initialXrefSize) { addToBody(obj, obj.getIndRef(), j != rootN);
PdfObject obj = reader.getPdfObjectRelease(j); if (obj != null && skipInfo != j && j < initialXrefSize) { addToBody(obj, obj.getIndRef(), j != rootN);