int efficientPDFPageCount(String path) { RandomAccessFileOrArray file = new RandomAccessFileOrArray(path, false, true ); PdfReader reader = new PdfReader(file); int ret = reader.getNumberOfPages(); reader.close(); return ret; }
public RandomAccessFileOrArray getSafeFile() { return new RandomAccessFileOrArray(file); }
public RandomAccessFileOrArray getSafeFile() { return new RandomAccessFileOrArray(file); }
TiffImage.getNumberOfPages(new RandomAccessFileOrArray(/* your file, input stream or byte array */));
PdfReader pdfReader = null; try{ Document.plainRandomAccess=true; pdfReader = new PdfReader(new RandomAccessFileOrArray("D://bigfile.pdf"),null); }catch(Exception e){ System.out.println("Error"); e.printStackTrace(); }
EnumerateTTC(String ttcFile) throws DocumentException, IOException { fileName = ttcFile; rf = new RandomAccessFileOrArray(ttcFile); findNames(); }
EnumerateTTC(byte ttcArray[]) throws DocumentException, IOException { fileName = "Byte array TTC"; rf = new RandomAccessFileOrArray(ttcArray); findNames(); }
EnumerateTTC(String ttcFile) throws DocumentException, IOException { fileName = ttcFile; rf = new RandomAccessFileOrArray(ttcFile); findNames(); }
EnumerateTTC(byte ttcArray[]) throws DocumentException, IOException { fileName = "Byte array TTC"; rf = new RandomAccessFileOrArray(ttcArray); findNames(); }
synchronized protected byte[] getSubSet(HashSet glyphs, boolean subsetp) throws IOException, DocumentException { TrueTypeFontSubSet sb = new TrueTypeFontSubSet(fileName, new RandomAccessFileOrArray(rf), glyphs, directoryOffset, true, !subsetp); return sb.process(); }
synchronized protected byte[] getSubSet(HashSet glyphs, boolean subsetp) throws IOException, DocumentException { TrueTypeFontSubSet sb = new TrueTypeFontSubSet(fileName, new RandomAccessFileOrArray(rf), glyphs, directoryOffset, true, !subsetp); return sb.process(); }
/** * Utility method that checks the provided byte source to see if it has junk bytes at the beginning. If junk bytes * are found, construct a tokeniser that ignores the junk. Otherwise, construct a tokeniser for the byte source as it is * @param byteSource the source to check * @return a tokeniser that is guaranteed to start at the PDF header * @throws IOException if there is a problem reading the byte source */ private static PRTokeniser getOffsetTokeniser(RandomAccessSource byteSource) throws IOException{ PRTokeniser tok = new PRTokeniser(new RandomAccessFileOrArray(byteSource)); int offset = tok.getHeaderOffset(); if (offset != 0){ RandomAccessSource offsetSource = new WindowRandomAccessSource(byteSource, offset); tok = new PRTokeniser(new RandomAccessFileOrArray(offsetSource)); } return tok; }
/** * Utility method that checks the provided byte source to see if it has junk bytes at the beginning. If junk bytes * are found, construct a tokeniser that ignores the junk. Otherwise, construct a tokeniser for the byte source as it is * @param byteSource the source to check * @return a tokeniser that is guaranteed to start at the PDF header * @throws IOException if there is a problem reading the byte source */ private static PRTokeniser getOffsetTokeniser(RandomAccessSource byteSource) throws IOException{ PRTokeniser tok = new PRTokeniser(new RandomAccessFileOrArray(byteSource)); int offset = tok.getHeaderOffset(); if (offset != 0){ RandomAccessSource offsetSource = new WindowRandomAccessSource(byteSource, offset); tok = new PRTokeniser(new RandomAccessFileOrArray(offsetSource)); } return tok; }
/** * Creates an independent view of this object (with it's own file pointer and pushback queue). Closing the new object will not close this object. * Closing this object will have adverse effect on the view. * @return the new view */ public RandomAccessFileOrArray createView(){ return new RandomAccessFileOrArray(new IndependentRandomAccessSource(byteSource)); }
/** * Creates an independent view of this object (with it's own file pointer and pushback queue). Closing the new object will not close this object. * Closing this object will have adverse effect on the view. * @return the new view */ public RandomAccessFileOrArray createView(){ return new RandomAccessFileOrArray(new IndependentRandomAccessSource(byteSource)); }
public PRTokeniser getLocation(String location) throws IOException { return new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(data))); } }
public PRTokeniser getLocation(String location) throws IOException { return new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(data))); } }
public PRTokeniser getLocation(String location) throws IOException { String fullName = BaseFont.RESOURCE_PATH + "cmaps/" + location; InputStream inp = StreamUtil.getResourceStream(fullName); if (inp == null) throw new IOException(MessageLocalization.getComposedMessage("the.cmap.1.was.not.found", fullName)); return new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(inp))); } }
public PRTokeniser getLocation(String location) throws IOException { String fullName = BaseFont.RESOURCE_PATH + "cmaps/" + location; InputStream inp = StreamUtil.getResourceStream(fullName); if (inp == null) throw new IOException(MessageLocalization.getComposedMessage("the.cmap.1.was.not.found", fullName)); return new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(inp))); } }
protected byte[] getFullFont() throws IOException { RandomAccessFileOrArray rf2 = null; try { rf2 = new RandomAccessFileOrArray(rf); rf2.reOpen(); byte b[] = new byte[(int) rf2.length()]; rf2.readFully(b); return b; } finally { try { if (rf2 != null) { rf2.close(); } } catch (Exception e) { } } }