Hey Andreas, yeah I tried my hints as some kind of quick-and-dirty implementations.
Sharing the PageWriter: In my version I'm sharing the PageWriter. I just create an instance in my code and pass it by my own convertToImage(PageWriter). ;) Just for testing issues. But the performance gains are not so big. Sharing a BufferedImage: I tried this and got a performance boost, but than I asked me, if I ever read a PDF with different page sizes. Due some scaling problems which I had with my implementation I just commented the code out and thought that I should give this mailing list a try. :) Is there a way to convert a pdf page to an image without the images? I couldn't figure out how to do it. "Bad question": Is there a Java 5 version? :) Thanks for your help so far, Daniel 2008/11/11 <[EMAIL PROTECTED]> > > 1. PageWriter: > > Every time the convertToImage method is called there will be a new > PageDrawer created > > and the parent class PDFStreamEngine loads the resource bundles. > > > > Why not use some kind of a cache for loading the bundles? (Load resources > just ones) > It's a little bit complicated. As I understood, the resources contains the > operator-class-mapping. Every entry will be linked to the PDFStreamEngine as > some sort of callback-mechanism. Consequently every instance of a > PDFStreamEngine needs its own mapping. > > > Why not use one PageWriter for the whole document? (Just share it) > This could be done easily. > > > 2. PageWriter: > > Every time the convertToImage method is called there will be a new > BufferedImage+Graphics. > > (but not so expensive like Graphics2D.scale() ;)) > > > > Why not reuse a BufferedImage for all pages? It is faster to call > > Graphics2d.fillRect() than creating a new one. > This is a litte bit complicated too. Within a pdf-document all pages may > have a different size and orientation. So, thinking about oo-programming, > only the class PDPage "knows" everything about the page, consequently PDPage > has to provide the conversion to a image. > > A this point the main questions is: did you ever implement your suggestions > to compare the performance? Or, are these thoughts theoretical? Did you > perhaps use some kind of a profiler? > > I'm using this feature (convertToImage, printing) as well, and I don't have > any serious performance-issues. But if there is some potential to speed up > pdfbox, let's try to do it. But we have to compare the costs against the > profit. > > > Greetings from rainy Essen just in the middle of the Ruhrpott ;-) > Andreas > > 2008/11/11 <[EMAIL PROTECTED]> > > > Hi Daniel, > > > > don't hesitate, I guess your suggestions are welcome wether they will > > included or not. > > > > > > Andreas > > > > > > -----Ursprüngliche Nachricht----- > > Von: Daniel Manzke [mailto:[EMAIL PROTECTED] > > Gesendet: Dienstag, 11. November 2008 12:49 > > An: [email protected] > > Betreff: Performance Tuning > > > > > > Hi there, > > first I have to say:"Good job." It's really a nice project. > > > > > > I'm using the PDFBox for transforming PDF to Image. But I have some > > performance issues, so I had a look at the source code. I saw several > > points where I could save time. ;) Are you interested in them? I would > > prefer that we could discuss about this, because maybe it is as > > designed and my steps are dangerous. > > > > > > > > Best Regards, > > Daniel > > > > ---------------------------------------------------------------- > > - Geschaeftsfuehrung: Chittur Ramakrishnan (Vorsitzender), Stefan > > Niehusmann - > > - Sitz der Gesellschaft: Dortmund - > > - Eingetragen beim Amtsgericht Dortmund - > > - Handelsregister-Nr. HR B 21222 - > > - USt.-IdNr. DE 2588 96 719 - > > > > > > -- > Mit freundlichen Grüßen > > Daniel Manzke > > ---------------------------------------------------------------- > - Geschaeftsfuehrung: Chittur Ramakrishnan (Vorsitzender), > Stefan Niehusmann - > - Sitz der Gesellschaft: Dortmund - > - Eingetragen beim Amtsgericht Dortmund - > - Handelsregister-Nr. HR B 21222 - > - USt.-IdNr. DE 2588 96 719 - > -- Mit freundlichen Grüßen Daniel Manzke
