CCITT encoding in PDF files – Decoding CCITT data

As part of the rewrite of our Java CCITT Decoder, I have spent a lot of time with the format. It is quite a complicated topic so I thought some articles would be helpful.

There are actually several types of CCITT. When decoding CCITT encoded PDF files there are three different types of CCITT formats that could be encountered. This is usually differentiated by the K-value in the PDF file. The K-value by default is set to 0 however; it could be greater or less than zero depending on the CCITT format used in encoding the PDF file.

Have a look at this example from a PDF file created with OpenOffice which has a K-value of -1. Notice also that we ignore Rows because it has a value of zero (obviously not possible).

The main types of CCITT format used in encoding PDFs include:

  • Group 3 One-Dimensional (G31D): usually have a K-value of 0.
  • Group 3 Two-Dimensional (G32D): usually have a K-values greater than 0.
  • Group 4 Two-Dimensional (G42D): usually have K-values less than 0.

All these formats have their advantages and work differently in how the data in the PDF stream is decoded. The names of the formats are quite self explanatory in the way that they work except for the G42D which works in a more interesting manner. This would be covered in future articles. Stay tuned!

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!

Related Posts:

The following two tabs change content below.
Chika has written much of the JavaFX converter and also helps with the HTML5 converter. When not experimenting with the new features of JavaFX, he is a keen basketball player (he is the tall guy you might see at Devoxx).
Chika Okereke

About Chika Okereke

Chika has written much of the JavaFX converter and also helps with the HTML5 converter. When not experimenting with the new features of JavaFX, he is a keen basketball player (he is the tall guy you might see at Devoxx).

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>