Antonio

For complex pages or pages with many images 4-5 seconds is to be expected.
If the page in question is very simple there may be something PDFBox can fix
to seed things up. If so, open an issue on the PDFBox JIRA and attach the PDF
file via More > Attach Files.

Before doing so, please try the latest 2.0.0 trunk snapshot, we have recently 
made
a number of performance improvements.

Some general speed tips: use TYPE_INT_RGB or TYPE_INT_ARGB buffers,
not *_BGR and try rendering at a lower resolution, if possible.

-- John

On 25 Feb 2014, at 06:15, Antonio González <[email protected]> wrote:

> Hi
> 
> When i convert a PDF file a Image is very slow 4 o 5 secs.
> 
> my code is
> 
> 
> String fichero = "C:\\guiaalfresco.pdf";
> PDDocument pdfDocument= null;
> try {
> File file = new File(fichero);
> pdfDocument = PDDocument.load(file);
> List pages = pdfDocument.getDocumentCatalog().getAllPages();
> if (pages.size()>0){
> // Captura la primera página del PDF
> PDPage page = (PDPage) pages.get(0);
> // Convierta la página PDF a Image
> BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_BGR,200 );
> pdfDocument.close();
> File outputfile = new File("c:\\saved.png");
>  BufferedImage imagen=resizeImage(image, 200);
>  ImageIO.write(imagen, "png", outputfile);
> }
> } catch (IOException e) {
> e.printStackTrace();
> }

Reply via email to