Right - in fact I already have them all in memory in an ImageIcon array, properly scaled and all... What I really want to do is simply tell the html parser to use these instead of building new ones. By the way, what exactly do I add the "setProviders(map);" to? The code I have is only this:
HashMap map = new HashMap(); map.put("img_provider", new MyImageFactory()); File ff = new File(OutP);if (ff.exists()) {ff.delete();} com.itextpdf.text.Document d = new com.itextpdf.text.Document (PageSize.LETTER, 40, 40, 40, 40); HashMap map = new HashMap(); map.put("img_provider", new MyImageFactory()); d.setProviders(map); try {PdfWriter.getInstance(d, new FileOutputStream (OutP));d.open (); FileReader fr = new FileReader(OutF); ArrayList elementlist = com.itextpdf.text.html.simpleparser.HTMLWorker.parseToList(fr, null); for (int i = 0; i < elementlist.size(); i++) {com.itextpdf.text.Element element = (com.itextpdf.text.Element)elementlist.get(i); d.add(element);} d.close (); } catch(Exception de) {System.err.println("Ouch!!! " + de.getMessage());return(-2);} I can't do d.setProviders(map) or com.itextpdf.text.html.simpleparser.HTMLWorker.setProviders(map) or fr.setProviders(map), and I can't figure out what to associate it with... FC On Mar 25, 2010, at 11:43 AM, 1T3XT info wrote: > Fred Cohen wrote: >> Ah. I wish I would have known this before buying the older one >> earlier today. I was wondering, specifically, why you don't do this >> anyway. After all, the same image should not be repeated unless >> there is a good reason to do so. > > iText = speed > > When you create an Image and add it to a Document, a unique id is > created for the Image object and all the bytes are written to the > OutputStream. When you add the same object again, this id is > detected and the reference to the original image is used. > > What you are asking would mean that we have to keep all the image > bytes of all the images in memory and compare the bytes of a new > image with the image bytes of all the previous images. > > That would slow everything down. > No, no, no, in your case, the best way is to create a cache based on > the path to the image, you don't want to compare the images on a > byte level. > -- > This answer is provided by 1T3XT BVBA > http://www.1t3xt.com/ - http://www.1t3xt.info > > - This communication is confidential to the parties it is intended to serve - Fred Cohen & Associates tel/fax: 925-454-0171 http://all.net/ 572 Leona Drive Livermore, CA 94550 Join http://groups.google.com/group/fca-announce for our mailing list ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.itextpdf.com/book/ Check the site with examples before you ask questions: http://www.1t3xt.info/examples/ You can also search the keywords list: http://1t3xt.info/tutorials/keywords/