A PDF file consists of instructions to draw the page onto a screen. This is normally done by a computer program so it places a great deal of importance on how well written the drawing code is. The PDF file format includes a wide range of commands so that the key difference is often how well the drawing program makes use of different commands.
I was examining a PDF file last week which included a square box drawn with rounded corners. The PDF file format includes commands to draw lines and circle segments, so it can be draw with 4 line commands and 4 curve commands. Curves have start and end points and control points so they are easy to construct and change. This shape did not use curve commands though and instead used 200 line commands – the corners were drawn as a set of tiny lines which look like a curve. This matters for 3 reasons:-
1. It actually makes it harder to draw a smooth line. With a curve, the renderer can optimise the curve which is not possible with lots of smaller lines.
2. It makes a larger, slower file. The file is much larger and it will render slower.
3. The file is much harder to edit. Instead of 1 curve, you would need to hack the file if you wanted to alter the corners.
So you end up with the worst of all worlds – larger, slower files which are much harder to edit. How good are your PDF files?
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!
Are you a Developer working with PDF files?
Our developers guide contains a large number of technical posts to help you understand the PDF file Format.
Find out more about our software for Developers
|Convert PDF to HTML5 or SVG|
|Convert AcroForms and XFA to HTML5|
|Java PDF SDK for working with PDF files|