/** * Add an image to the cache. This method should be used for images * which have already been completely rendered * * @param page page this image is associated with * @param info the image info associated with this image * @param image the image to add */ public void addImage(PDFPage page, ImageInfo info, BufferedImage image) { addImageRecord(page, info, image, null); }
/** * Add a page to the cache. This method should be used for * pages which have already been completely rendered. * * @param pageNumber the page number of this page * @param page the page to add */ public void addPage(Integer pageNumber, PDFPage page) { addPageRecord(pageNumber, page, null); }
/** * Get an image's renderer from the cache * * @param page the page this image was generated from * @param info the image info describing the image * @return the renderer, or null if it is not in the cache */ public PDFRenderer getImageRenderer(PDFPage page, ImageInfo info) { Record rec = getImageRecord(page, info); if (rec != null) { return (PDFRenderer) rec.generator; } // not found return null; }
boolean needread = false; PDFPage page = cache.getPage(key); PDFParser parser = cache.getPageParser(key); if (page == null) { try { parser = new PDFParser(page, stream, resources); cache.addPage(key, page, parser); } catch (IOException ioe) { System.out.println("GetPage inner loop:");
image = cache.getImage(this, info); renderer = cache.getImageRenderer(this, info); cache.addImage(this, info, image, renderer);
/** * The internal routine to add an image to the cache and return the * record that was generated. */ Record addImageRecord(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) { // first, find or create the relevant page record Integer pageNumber = new Integer(page.getPageNumber()); PageRecord pageRec = getPageRecord(pageNumber); if (pageRec == null) { pageRec = addPageRecord(pageNumber, page, null); } // next, create the image record Record rec = new Record(); rec.value = image; rec.generator = renderer; // add it to the cache pageRec.images.put(info, new SoftReference<Record>(rec)); return rec; }
/** * Stop the rendering of a particular image on this page */ public void stop(int pageNum) { PDFParser parser = cache.getPageParser(new Integer(pageNum)); if (parser != null) { // stop it parser.stop(); } }
/** * get a PDFFile from a .pdf file. The file must me a random access file * at the moment. It should really be a file mapping from the nio package. * <p> * Use the getPage(...) methods to get a page from the PDF file. * @param buf the RandomAccessFile containing the PDF. * @param password the user or owner password * @throws IOException if there's a problem reading from the buffer * @throws PDFParseException if the document appears to be malformed, or * its features are unsupported. If the file is encrypted in a manner that * the product or platform does not support then the exception's {@link * PDFParseException#getCause() cause} will be an instance of {@link * UnsupportedEncryptionException}. * @throws PDFAuthenticationFailureException if the file is password * protected and the supplied password does not decrypt the document */ public PDFFile(ByteBuffer buf, PDFPassword password) throws IOException { this.buf = buf; cache = new Cache(); parseFile(password); }
boolean needread = false; PDFPage page = cache.getPage(key); PDFParser parser = cache.getPageParser(key); if (page == null) { try { parser = new PDFParser(page, stream, resources); cache.addPage(key, page, parser); } catch (IOException ioe) { System.out.println("GetPage inner loop:");
image = cache.getImage(this, info); renderer = cache.getImageRenderer(this, info); cache.addImage(this, info, image, renderer);
/** * The internal routine to add an image to the cache and return the * record that was generated. */ Record addImageRecord(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) { // first, find or create the relevant page record Integer pageNumber = new Integer(page.getPageNumber()); PageRecord pageRec = getPageRecord(pageNumber); if (pageRec == null) { pageRec = addPageRecord(pageNumber, page, null); } // next, create the image record Record rec = new Record(); rec.value = image; rec.generator = renderer; // add it to the cache pageRec.images.put(info, new SoftReference<Record>(rec)); return rec; }
/** * Stop the rendering of a particular image on this page */ public void stop(int pageNum) { PDFParser parser = cache.getPageParser(new Integer(pageNum)); if (parser != null) { // stop it parser.stop(); } }
/** * get a PDFFile from a .pdf file. The file must me a random access file * at the moment. It should really be a file mapping from the nio package. * <p> * Use the getPage(...) methods to get a page from the PDF file. * @param buf the RandomAccessFile containing the PDF. * @param password the user or owner password * @throws IOException if there's a problem reading from the buffer * @throws PDFParseException if the document appears to be malformed, or * its features are unsupported. If the file is encrypted in a manner that * the product or platform does not support then the exception's {@link * PDFParseException#getCause() cause} will be an instance of {@link * UnsupportedEncryptionException}. * @throws PDFAuthenticationFailureException if the file is password * protected and the supplied password does not decrypt the document */ public PDFFile(ByteBuffer buf, PDFPassword password) throws IOException { this.fileBuf = buf; cache = new Cache(); parseFile(password); }
boolean needread = false; PDFPage page = cache.getPage(key); PDFParser parser = cache.getPageParser(key); if (page == null) { try { parser = new PDFParser(page, stream, resources); cache.addPage(key, page, parser); } catch (IOException ioe) { System.out.println("GetPage inner loop:");
image = cache.getImage(this, info); renderer = cache.getImageRenderer(this, info); cache.addImage(this, info, image, renderer);
/** * The internal routine to add an image to the cache and return the * record that was generated. */ Record addImageRecord(PDFPage page, ImageInfo info, BufferedImage image, PDFRenderer renderer) { // first, find or create the relevant page record Integer pageNumber = new Integer(page.getPageNumber()); PageRecord pageRec = getPageRecord(pageNumber); if (pageRec == null) { pageRec = addPageRecord(pageNumber, page, null); } // next, create the image record Record rec = new Record(); rec.value = image; rec.generator = renderer; // add it to the cache pageRec.images.put(info, new SoftReference<Record>(rec)); return rec; }
/** * Add a page to the cache. This method should be used for * pages which are still in the process of being rendered. * * @param pageNumber the page number of this page * @param page the page to add * @param parser the parser which is parsing this page */ public void addPage(Integer pageNumber, PDFPage page, PDFParser parser) { addPageRecord(pageNumber, page, parser); }
/** * Add an image to the cache. This method should be used for images * which have already been completely rendered * * @param page page this image is associated with * @param info the image info associated with this image * @param image the image to add */ public void addImage(PDFPage page, ImageInfo info, BufferedImage image) { addImageRecord(page, info, image, null); }
/** * Get an image's renderer from the cache * * @param page the page this image was generated from * @param info the image info describing the image * @return the renderer, or null if it is not in the cache */ public PDFRenderer getImageRenderer(PDFPage page, ImageInfo info) { Record rec = getImageRecord(page, info); if (rec != null) { return (PDFRenderer) rec.generator; } // not found return null; }
/** * Stop the rendering of a particular image on this page */ public void stop(int pageNum) { PDFParser parser = cache.getPageParser(new Integer(pageNum)); if (parser != null) { // stop it parser.stop(); } }