/** * Creates a PdfImage object. * @param stream a PRStream * @throws IOException */ public PdfImageObject(PRStream stream) throws IOException { this(stream, PdfReader.getStreamBytesRaw(stream), null); }
/** * Creates a PdfImage object. * @param stream a PRStream * @param colorSpaceDic a color space dictionary * @throws IOException */ public PdfImageObject(PRStream stream, PdfDictionary colorSpaceDic) throws IOException { this(stream, PdfReader.getStreamBytesRaw(stream), colorSpaceDic); }
/** * Creates a PdfImage object. * @param stream a PRStream * @throws IOException */ public PdfImageObject(PRStream stream) throws IOException { this(stream, PdfReader.getStreamBytesRaw(stream), null); }
/** * Creates a PdfImage object. * @param stream a PRStream * @param colorSpaceDic a color space dictionary * @throws IOException */ public PdfImageObject(PRStream stream, PdfDictionary colorSpaceDic) throws IOException { this(stream, PdfReader.getStreamBytesRaw(stream), colorSpaceDic); }
/** Get the content from a stream applying the required filters. * @param stream the stream * @param file the location where the stream is * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytes(final PRStream stream, final RandomAccessFileOrArray file) throws IOException { byte[] b = getStreamBytesRaw(stream, file); return decodeBytes(b, stream); }
/** Get the content from a stream applying the required filters. * @param stream the stream * @param file the location where the stream is * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytes(final PRStream stream, final RandomAccessFileOrArray file) throws IOException { byte[] b = getStreamBytesRaw(stream, file); return decodeBytes(b, stream); }
/** Get the content from a stream as it is without applying any filter. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytesRaw(final PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytesRaw(stream, rf); } finally { try{rf.close();}catch(Exception e){} } }
/** Get the content from a stream as it is without applying any filter. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytesRaw(final PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytesRaw(stream, rf); } finally { try{rf.close();}catch(Exception e){} } }
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte[] b = PdfReader.getStreamBytesRaw(this); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); PdfObject objLen = get(PdfName.LENGTH); int nn = b.length; if (crypto != null) nn = crypto.calculateStreamSize(nn); put(PdfName.LENGTH, new PdfNumber(nn)); superToPdf(writer, os); put(PdfName.LENGTH, objLen); os.write(STARTSTREAM); if (length > 0) { if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); os.write(b); } os.write(ENDSTREAM); } }
private boolean compareStreamsExtended(PRStream outStream, PRStream cmpStream, ObjectPath currentPath, CompareResult compareResult) throws IOException { boolean decodeStreams = PdfName.FLATEDECODE.equals(outStream.get(PdfName.FILTER)); byte[] outStreamBytes = PdfReader.getStreamBytesRaw(outStream); byte[] cmpStreamBytes = PdfReader.getStreamBytesRaw(cmpStream); if (decodeStreams) { outStreamBytes = PdfReader.decodeBytes(outStreamBytes, outStream);
public void toPdf(PdfWriter writer, OutputStream os) throws IOException { byte[] b = PdfReader.getStreamBytesRaw(this); PdfEncryption crypto = null; if (writer != null) crypto = writer.getEncryption(); PdfObject objLen = get(PdfName.LENGTH); int nn = b.length; if (crypto != null) nn = crypto.calculateStreamSize(nn); put(PdfName.LENGTH, new PdfNumber(nn)); superToPdf(writer, os); put(PdfName.LENGTH, objLen); os.write(STARTSTREAM); if (length > 0) { if (crypto != null && !crypto.isEmbeddedFilesOnly()) b = crypto.encryptByteArray(b); os.write(b); } os.write(ENDSTREAM); } }
private boolean compareStreamsExtended(PRStream outStream, PRStream cmpStream, ObjectPath currentPath, CompareResult compareResult) throws IOException { boolean decodeStreams = PdfName.FLATEDECODE.equals(outStream.get(PdfName.FILTER)); byte[] outStreamBytes = PdfReader.getStreamBytesRaw(outStream); byte[] cmpStreamBytes = PdfReader.getStreamBytesRaw(cmpStream); if (decodeStreams) { outStreamBytes = PdfReader.decodeBytes(outStreamBytes, outStream);
if (level > 0) { md5.reset(); bb.append(md5.digest(PdfReader.getStreamBytesRaw((PRStream)obj)));
if (level > 0) { md5.reset(); bb.append(md5.digest(PdfReader.getStreamBytesRaw((PRStream)obj)));
PdfObject xmpo = PdfReader.getPdfObject(catalog.get(PdfName.METADATA)); if (xmpo != null && xmpo.isStream()) { altMetadata = PdfReader.getStreamBytesRaw((PRStream) xmpo); PdfReader.killIndirect(catalog.get(PdfName.METADATA));
PdfObject xmpo = PdfReader.getPdfObject(catalog.get(PdfName.METADATA)); if (xmpo != null && xmpo.isStream()) { altMetadata = PdfReader.getStreamBytesRaw((PRStream) xmpo); PdfReader.killIndirect(catalog.get(PdfName.METADATA));