pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Thomas Panicker <ro...@qburst.com>
Subject Re: pdf to image conversion Web
Date Sat, 23 Nov 2013 13:36:53 GMT
Hello Balaji, pdf2image conversion is a CPU intensive process.  Did you do
the load test on your dev box or your staging box? If it's your dev box
then the figures are not heavily alarming.  Also, i assume you are
converting the entire pdf into images.

In your application, would it be possible to do the conversion offline
instead of online? That would reduce the end users wait time..

On 23 Nov 2013 09:33, "Ranganathan, Balaji" <Balaji.Ranganathan@apria.com>
wrote:

> Hi,
>
> I am developing a java web application where use will upload a pdf file
> and the web application will convert the pdf to png images and send
> embedded html email.
>
> The pdf is around 6 pages, the application takes around 9 sec to convert
> the pdf to png using PDPage.convertToImage method.
>
> When I do a load test of the application with 10 concurrent users the
> page.convertToImage take around 60 secs.,
> The performance decreases further if the concurrent users are more.
>
> I am using pdfbox 1.8.2
>
> Below is the code I am using to convert to image
>
> PDDocument document = PDDocument.loadNonSeq(new File(pdfFileName),
> scratchFile);
> List<PDPage> pageList = document.getDocumentCatalog().getAllPages();
> int pageSize = pageList.size();
> String[] retVal = new String[pageSize];
> int imgType = BufferedImage.TYPE_BYTE_BINARY;
> int i = 0;
>
> for (PDPage page : pageList) {
>             BufferedImage image = page.convertToImage(imgType, 133);
>             if (image.getGraphics() != null) {
>                         image.getGraphics().dispose();
>             }
>             ImageIOUtil.writeImage(image, "png", prefix + i, imgType, 133);
>             i++;
>
> Let me know if there is any problem with the code.
>
> Let me know if I am doing any mistakes or converToImage can only be used
> in desktop applications?
>
> Balaji Ranganathan
>
> ________________________________
> Confidentiality Notice: This e-mail is intended only for the person(s) to
> whom it is addressed and may contain information that is confidential,
> proprietary, privileged or otherwise protected from disclosure. If you are
> not an intended recipient, please (i) do not read, copy or use this
> communication, or disclose it to others, (ii) notify the sender immediately
> by replying to the message, and (iii) delete the e-mail from your system.
> Thank you.
>

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