PDF to TIFF – Convert PDF files to multi-page TIFF images 4

XFINIUM.PDF 5.1 brings support for native PDF to TIFF conversion. What this means is that we implemented a full TIFF encoder so that this functionality is now available on all platforms.

The conversion of a PDF file to a multi-page TIFF is implemented through the PdfDocumentRenderer class. Once a PDF file is loaded in a PdfFixedDocument it can be converted to multi-page TIFF with a few lines of code.

By default the PDF file is converted to RGBA TIFF but grayscale and B/W TIFFs are supported.

In order to create a 1bpp B/W TIFF a black and white rendering surface must be provided as model in the rendering settings.

When converting a PDF file to B/W TIFF each PDF page is initially rendered in grayscale and then the grayscale image is converted to B/W. The process of converting the grayscale image to B/W is called binarization and we implemented this process through binarization filters. The most simple filter is the threshold filter. This filter converts the values above the threshold to white and the values below the threshold to black.

Using this source PDF page the result of converting it to B/W TIFF looks like this when using the threshold filter:

PDF to TIFF - Source PDF page

Source PDF page

PDF to TIFF - B/W page image using threshold filter

B/W page image using threshold filter

As you can see a lot of details are lost during the conversion. In order to avoid this we support also several error diffusion dithering filters including the well-known Floyd-Steinberg filter.
The binarization filter is specified as an attribute of the black and white rendering surface.

Using the same source PDF page the result of converting it to B/W TIFF looks like this when using the Floyd-Steinberg filter:

PDF to TIFF - Source PDF page

Source PDF page

PDF to TIFF - B/W page image using Floyd-Steinberg dithering

B/W page image using Floyd-Steinberg dithering

We support 10 binarization filters: 1 simple filter (threshold filter) and 9 dithering based filters (Bayer which uses ordered dithering and
Atkinson, Burkes, Floyd-Steinberg, Jarvis Judice Ninke, Sierra, Sierra Lite, Sierra 2 Row and Stucki that use error diffusion dithering).
The 1bpp B/W images are compressed using CCITT G4 compression.

Download XFINIUM.PDF library and give it a try.

4 thoughts on “PDF to TIFF – Convert PDF files to multi-page TIFF images

  1. Reply Mayank Sheth Nov 16,2017 7:20 am

    Hello,
    Is there way to turn off compression while converting from PDF to TIFF (or jpeg) file? I am trying to convert PDF to jpeg with certain DPI ratio but due to compression and bit rate reduction it becomes impossible to read the contents of image.
    Please help.
    Thanks,
    Mayank Sheth.

    • Reply xfinium.pdf Nov 16,2017 9:47 am

      When doing PDF to color TIFF conversion, the output TIFF image is uncompressed. Can you send us (support@xfiniumpdf.com) a sample project that we can run and reproduce the problem you reported?

  2. Reply Stefan Fabian Nov 17,2017 7:56 pm

    Is there any way to render to an image of a specific size other than first checking what size the image would be for a specific DPI and using the result to calculate the required dpi for the desired size?
    Like either the dpi of the page which would result in the page’s width and height or potentially a width and a height property for the renderersettings that can be used instead of the dpi.

Leave a Reply