Chika Okereke Chika is a Java developer. When not experimenting with the new features of Java, he is a keen basketball player (he is the tall guy you might see at Devoxx).

CCITT encoding in PDF files – Decoding CCITT data

1 min read

TIFF icon

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!

Do you need to read or write Tiff files in Java?

Our JDeli image library offers a range of advantages over ImageIO and alternatives for Tiff files, including:

  • prevents heap related JVM crashes
  • reads 1-32 bit bilevel, grayscale, rgb, argb, cmyk, acmyk, ycbcr Colorspaces, and converts to sRGB BufferedImage
  • implements both Little and Big Endian Byte Ordering
  • decompresses uncompressed, CCITT group 3 and 4, Deflate/Adobe Deflate, LZW, Packbits
  • support for Single, Multi-file, Tiling, Planar (Chunky, Separated), Predictor, 16,32 bit floating samples
  • improve read performance
  • supports threading
  • superior image scaling algorithms


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.

Do you need to solve any of these problems?

Display PDF documents in a Web app
Use PDF Forms in a web browser
Convert PDF Documents to an image
Work with PDF Documents in Java
Chika Okereke Chika is a Java developer. When not experimenting with the new features of Java, 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 *

IDRsolutions Ltd 2022. All rights reserved.