> > > Although I looked through a few different threads, I couldn't find anything > that answered my exact problem (apologies if I missed something). > > I am creating a PDF document that needs to support many images - upwards of > 20 unique images. Generating the PDF takes ~1 second per image (my testing > determined images are the bottleneck), which is a problem as I need to > generate these PDFs dynamically, and this is just too long to wait :( ... > > Here is the code I am using for each image: > > image = Image.getInstance(url); > image.setAbsolutePosition(left, top - depth); > image.scaleAbsolute(width, depth); > d.add(image); > > About half of the time per image is consumed by "image = > Image.getInstance(url);" - unfortunately, I don't think there's an > alternative here, however if anyone has a faster way of doing this, that'd > be appreciated.
Does this point to some other machine? Or a local file on disk somewhere? You can of course cache these or maybe compress but in any case this is not a PDF problem if limited by IO. > > However, the other time consumption is due to actually adding the images to > the document - my question is if there's a way to speed up this step. > > Of course, if this is the best performance I can expect from iText, that > would be great to know too, so that I can start looking into other PDF > libraries. Presumably you'd like to get some indication that the other libraries could be faster by determing that there is a better code or algorithm alternative to that used by itext ( native code may be faster too). It could just be that the task takes a lot of work. Often, however, you find things like memory usage rather than instruction count become the limiting issues- if you have lots of big images, VM will still thrash them around unless you happen to get lucky. In this case you could probably get tremenduous speed ups by only keeping what you need in memory and writing completed stuff out as it is ready etc. The answer of course is that you should dig down deeper and see what the issue is more precisely. An itext person with knowledge of the code may have some suspects but you also could have some quirk specific to your system that causes bigger problems. _________________________________________________________________ The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail. http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4 ------------------------------------------------------------------------------ _______________________________________________ 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/