Export PDF pages to a series of images in Java

前端 未结 6 2143
你的背包
你的背包 2020-11-27 13:30

I need to export the pages of an arbitrary PDF document into a series of individual images in jpeg/png/etc format. I need to do this in in Java.

Although I do know

6条回答
  •  温柔的废话
    2020-11-27 13:54

    If you find out that the sun renderer is not working for all your PDF documents, you may look into using jPDFImages.

    To be more efficient, you should convert each PDF page to a buffered image and from there convert to the various image formats you need. This would avoid having to convert from PDF to images for each format.

    Here is the link to convert from PDF to buffered images using jPDFImages: http://kbdeveloper.qoppa.com/jpdfimages/codesampleconvertpdfpageintobufferedimageinjava

    For each page image you can simply export to different image formats: ImageIO.write(pageBufferedImage, "JPEG", outputFile); ImageIO.write(pageBufferedImage, "PNG", outputFile); etc...

提交回复
热议问题