protected void insureOpen() throws IOException { if (filename != null && rf == null && trf == null) { reOpen(); } }
protected void insureOpen() throws IOException { if (filename != null && rf == null && trf == null) { reOpen(); } }
protected void insureOpen() throws IOException { if (filename != null && rf == null && trf == null) { reOpen(); } }
/** * @param reader * @param openFile * @throws IOException */ public void registerReader(PdfReader reader, boolean openFile) throws IOException { if (this.readers2intrefs.containsKey(reader)) return; this.readers2intrefs.put(reader, new IntHashtable()); if (openFile) { RandomAccessFileOrArray raf = reader.getSafeFile(); this.readers2file.put(reader, raf); raf.reOpen(); } }
/** * @param reader * @param openFile * @throws IOException */ public void registerReader(PdfReader reader, boolean openFile) throws IOException { if (readers2intrefs.containsKey(reader)) return; readers2intrefs.put(reader, new IntHashtable()); if (openFile) { RandomAccessFileOrArray raf = reader.getSafeFile(); readers2file.put(reader, raf); raf.reOpen(); } }
/** * @param reader * @param openFile * @throws IOException */ public void registerReader(PdfReader reader, boolean openFile) throws IOException { if (readers2intrefs.containsKey(reader)) return; readers2intrefs.put(reader, new IntHashtable()); if (openFile) { RandomAccessFileOrArray raf = reader.getSafeFile(); readers2file.put(reader, raf); raf.reOpen(); } }
/** Gets the contents of the page. * @param pageNum the page number. 1 is the first * @throws IOException on error * @return the content */ public byte[] getPageContent(int pageNum) throws IOException{ RandomAccessFileOrArray rf = getSafeFile(); try { rf.reOpen(); return getPageContent(pageNum, rf); } finally { try{rf.close();}catch(Exception e){} } }
/** * Gets the global document JavaScript. * @throws IOException on error * @return the global document JavaScript */ public String getJavaScript() throws IOException { RandomAccessFileOrArray rf = getSafeFile(); try { rf.reOpen(); return getJavaScript(rf); } finally { try{rf.close();}catch(Exception e){} } }
/** * Gets the global document JavaScript. * @throws IOException on error * @return the global document JavaScript */ public String getJavaScript() throws IOException { RandomAccessFileOrArray rf = getSafeFile(); try { rf.reOpen(); return getJavaScript(rf); } finally { try{rf.close();}catch(Exception e){} } }
/** Gets the contents of the page. * @param pageNum the page number. 1 is the first * @throws IOException on error * @return the content */ public byte[] getPageContent(int pageNum) throws IOException{ RandomAccessFileOrArray rf = getSafeFile(); try { rf.reOpen(); return getPageContent(pageNum, rf); } finally { try{rf.close();}catch(Exception e){} } }
/** * Gets the global document JavaScript. * * @throws IOException * on error * @return the global document JavaScript */ public String getJavaScript() throws IOException { RandomAccessFileOrArray rf = getSafeFile(); try { rf.reOpen(); return getJavaScript(rf); } finally { try { rf.close(); } catch (Exception ignored) { } } }
/** * Extracts a revision from the document. * * @param field the signature field name * @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if it's not a signature field * @throws IOException on error */ public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) { return null; } int length = sigNames.get(field)[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
/** * Extracts a revision from the document. * * @param field the signature field name * @return an <CODE>InputStream</CODE> covering the revision. Returns <CODE>null</CODE> if * it's not a signature field * @throws IOException on error */ public InputStream extractRevision(String field) throws IOException { getSignatureNames(); field = getTranslatedFieldName(field); if (!sigNames.containsKey(field)) return null; int length = ((int[])sigNames.get(field))[0]; RandomAccessFileOrArray raf = reader.getSafeFile(); raf.reOpen(); raf.seek(0); return new RevisionStream(raf, length); }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte b[] = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte b[] = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte[] b = new byte[rf2.length()]; rf2.readFully(b); return b; } finally { try {if (rf2 != null) {rf2.close();}} catch (Exception e) {} } }
/** Get the content from a stream applying the required filters. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytes(PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytes(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(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(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 applying the required filters. * @param stream the stream * @throws IOException on error * @return the stream content */ public static byte[] getStreamBytes(PRStream stream) throws IOException { RandomAccessFileOrArray rf = stream.getReader().getSafeFile(); try { rf.reOpen(); return getStreamBytes(stream, rf); } finally { try{rf.close();}catch(Exception e){} } }