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)
- My experience of a Turkish bath (visiting Istanbul for DevFest) - November 24, 2017
- My 5 key takeaways from JavaOne 2017 - October 6, 2017
- My notes and pictures from thursday JavaOne 2017 - October 5, 2017
- My notes and pictures from Wednesday JavaOne 2017 - October 5, 2017
- My notes and pictures from Tuesday JavaOne 2017 - October 4, 2017