Which PDF filters are used to encode data?

Currently I am working with the iTextSharp library to generate PDF files. These files will be processed by some file processor. This PDF file processor has some limitations with respect to the PDF filters it can use to decode the data from the file. I am very keen to know which PDF filters are used by iTextSharp to encode the data so that it can decode the data properly.

Posted on StackOverflow on Jun 17, 2015 by Midhun

iTextSharp supports the filters that are defined in the PDF specification. That means that content streams (e.g. for pages) use /FlateDecode, which is what every other PDF producer will use by default, because that's the standard compression for PDF.

Image streams use other filters when applicable, for instance: JPEG images are stored using /DCTDecode, JBIG2 images are stored using /JBIG2Decode, CCITT images are stored using /CCITTFaxDecode, and so on.

It is hard to believe that there would be PDF software that doesn't support these filters. Maybe there is some very old software that doesn't support /JPXDecode (introduced in PDF 1.5; used whenever you try to introduce JPEG2000 images). However, that shouldn't be a problem as long as you don't introduce .jpx or .j2k images. Just so, /DCTDecode isn't used if you don't introduce any .jpg file, and so on.

Another thing we've noticed, is that some legacy software doesn't support compressed cross-reference tables, nor objects stored in a stream. This was introduced in PDF 1.5 (2003). That's why iTextSharp doesn't compress xref tables, nor introduces objects compressed into streams unless you intentionally instruct iTextSharp to do so.

Ready to use iText?

Try our iText 7 Library and add-ons FREE for 30 days. Test your proof of concept, and see if our solution is right for you.

Get my FREE trial

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now