Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Java PDF to PNG conversion

1 min read

PDF to PNG conversion raises a number of questions which seemed to be asked often, so I thought it would make a good topic for a blog article. I am always happy to write articles to answer any questions so please do contact us if you have any requests.

A PDF is a vector image (so it is rendered when you display it at whatever size you specify). A PNG is a bit-mapped file of a set size with fixed values. So to convert a PDF to PNG file we need to create a blank image and then draw the PDF onto this. Then will have the PNG file (or a TIF or JPEG – the process is the same).

This process is usually done with a PDF tool such as Acrobat and our Java PDF library also includes this functionality. There are lots of Open Source and commercial tools in most major languages. If you are using Java, it is not a function which is built into Java – you will need an external application to do this.

The usual reason for doing this conversion is to display the content as an image (for example a thumbnail on a website). However, there are things so remember:-

1. Bitmapped images do not scale very well (unlike Vector formats like PDF). So you need to get the size correct. If you make it too small you will not be able to zoom in without pixelation. If you make it too big you will make the download slower and need more memory.

2. Bitmapped images do not have some of the other advantages of PDF files (like text search).  You may need to add manual functionality to your application if you wish to have things like text highlighting.

3. If you are doing it to print the PDF you will need a very large image to get a quality print at 300 or 600 dpi (what looks good on screen at 72dpi will not appear as crisp on a printout).

So long as you remember these, Java PDF to PNG conversion is a straight-forward process.

If you would like to try it in Java using JPedal, have a look at our PDF to PNG conversion link.

If you need to work with PNG images, JPedal also includes our JDeli library which provides a complete PNG converter, being able to read and write PNG images from Java and many image file formats.


IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn about.

Mark Stephens Mark has been working with Java and PDF since 1999 and is a big NetBeans fan. He enjoys speaking at conferences. He has an MA in Medieval History and a passion for reading.

Why we wrote our own Java jpeg2000 libraries

JPEG2000 is an important image file format which offers significant benefits over JPEG. For our specific usage it does generate significantly smaller file sizes...
Mark Stephens
52 sec read

How to choose JPG versus JPEG2000 for image files

Since we started to support both JPG and JPG2000 as image file outputs in our software, we have found that this is a very...
Mark Stephens
1 min read

Leave a Reply

Your email address will not be published. Required fields are marked *

IDRsolutions Ltd 2019. All rights reserved.