Inline images and Type 3 fonts

I often hear that the inline image construct is a major flaw in the design of the PDF page description language. Inline images are an often used feature in Type 3 fonts. However, the stomach pain of some experts even caused them to adjust this feature in the upcoming PDF 2.0 standard.  What are inline images and why do some programmers of PDF readers feel uncomfortable about them?

The PDF page description language consists of operators by which text, graphics and images can be placed onto a blank page. If one wants to paint a raster image onto a page then the image object is given a name and added to the page resource dictionary. The painting operator then refers to the image resource by its name. The separation between operators and resources has the advantage that the page description is short and that the resource can be reused many times, e.g. if the image represent a company logo which is used on each page of a document.

The appearance of the characters (glyphs) of a type 3 font are described with the same operator language that is used to describe the appearance of the page. The appearance of such a glyph is mostly described by a small image mask. Since a font can have many glyphs and they usually have a unique appearance these image masks cannot be reused and the overhead to put each of them in a separate resource object is high. For this and similar use cases, PDF allows for placing small images directly into the operator stream. This feature is called 'inline image'.

Some programmers now argue that these inline images are difficult to parse. Indeed, if the pixel data is a compressed then the length of this image data can only be determined if the data is decompressed by the parser. And, if the parser doesn't know the length of the data then it cannot properly find the next operator. Therefore, an optional length attribute was introduced in PDF 2.0.

However, my personal opinion is that inline images, if used carefully in situations for which they have been design for, are a useful means to reduce the size of a PDF file. Decompressing the images in the parser isn't a real problem since they are usually very small. And, the length attribute doesn't really help since it is optional. Furthermore, the feature worked for more than 20 years.

If I missed something or if you have a different opinion please let me know and post a comment.

3 comments :

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. Hi there masterrific. You added the following comment: "Hi Hans, type 3 fonts come in default so it has some advantages to offer. But with updates coming out every now and then, most of us from ghostprofessors review encounter the same problem when using PDF. Since non of us are PDF technical then we often resort to Google searches for answers. Thank you for giving light to type 3 issues. I have read other post you have and will be back here regularly for more PDF related news."
    Thank you very much for your input and feedback on this article. Our policy does not allow for external linking, which is why we will remove this comment of yours. Please do not refrain from coming back to add to this blog, but remember to stick to our code of conduct.

    ReplyDelete