pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@lanin.de
Subject multi threaded rendering
Date Sun, 05 Jan 2014 02:20:54 GMT

Hi all,

first of all: yes I have read the FAQ. I know pdfbox is not thread safe.

I'm trying to render parts of a larger pdf to a BufferedImage. e.g.  
pages 5, 7, 10, 52, 53
However this is quite slow: My initial timing measurements show that  
opening a pdf takes about half a second and rendering a single page  
takes 0.8 - 2.5 seconds (Laptop; i7). So rendering e.g. 5 pages is 0.5  
+ 5 * 1.5 = 8 seconds. I'm using loadNonSeq and  
RenderUtil.convertToImage(page). I've also tried to use  
drawer.drawPage directly without creating BufferedImages for each  
page, same result.

Again, I know pdfbox is not thread safe. But anyway I had an idea to  
make it multi threaded: just open the document in each thread  
separately! So at least in theory we get: 0.5 (5 times simultaneously)  
+ 2.5 (slowest page) = 3 seconds total which would be less than half  
the time required before.

I haven't tested this yet, but maybe someone has already done  
something like this?

Regards,
Alex


Mime
View raw message