We were sent a PDF file last week which was slow and needed a lot of memory to decode. We investigated the file and found that it contained a huge image (6000×6000 pixels). The image data for this was encoded so it meant a big hit decompressing the data, then assembling the image before down-sampling it to appear on an 595×842 page.
Sometimes it is useful to have a large image, because you can then zoom in. But this would need a zoom of 750% to make full use of it. And it turned out it was actually a white box drawn on the screen for background. So you could actually have used a 1×1 pixel image to achieve the same thing.
So if you have control over your PDF files, ask yourself, do I need images that big or is it just bloat?
This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!
Latest posts by Mark Stephens (see all)
- Introducing the new XFA Parser in FormVu - May 16, 2018
- Moving to JPedal release 8 - May 2, 2018
- Which version of Java SE should I use? - April 25, 2018
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018