pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: High CPU load an memory usage, when converting PDF to Image
Date Wed, 22 Jul 2015 05:11:54 GMT
Hi,

It is not possible to attach PDFs here, please upload it somewhere so 
that we can have a look.

Tilman

Am 22.07.2015 um 06:46 schrieb von Daak, Frank:
> Hello!
>
> We are running a business web application, that is using pdfbox to 
> convert pdf-files to images, using PDPage.convertToImage().
> When we try to convert the attached pdf, the CPU load of tomcat is 
> raising and it seems, that the process hangs. The tomcat process is no 
> more responsive and after a long while, we get an memory overflow. 
> Also the server load is very high meanwhile.
> We have seen this on pdfbox 1.8.8, 1.8.9 and 1.8.11-SNAPSHOT
>
> Do you have an idea, how to prevent this?
>
> Our code looks like this:
>
> private void convertPDF2JPG(File inFile, String outFile) throws 
> Exception {
> PDDocument pdf = PDDocument.load(inFile);
> List<PDPage> allPages = 
> (List<PDPage>)pdf.getDocumentCatalog().getAllPages();
>
> for(PDPage pdPage: allPages) {
> int resolution = 220;
> BufferedImage bufferedImage = 
> pdPage.convertToImage(BufferedImage.TYPE_INT_RGB, resolution);
> Graphics2D bufImageGraphics = bufferedImage.createGraphics();
> bufImageGraphics.drawImage(bufferedImage, 0, 0, null);
> bufImageGraphics.dispose();
>
> convertAnyImage2JPG(bufferedImage, new File(outFile));
> }
>
> }
>
>
> Thank you very much and best regards,
> Frank
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message