FAQ: How Do I Convert Between PDF and TIFF


Note: The PdfDecoder class is part of our PdfReader (Formerly called PdfRasterizer) module, which is an add-on to DotImage. To use this class, you must add Atalasoft.dotImage.PdfReader.dll as a reference to your project, and you will need a license file for this module. You can request an evaluation license file for this module using the Request Evaluation page of our web site. Simply deselect all options and select only "DotImage PDF Reader"

You will also want to add a PdfDecoder to your RegisteredDecoders collection in a static constructor for your class:

C#

static MyClass()
{
    RegisteredDecoders.Decoders.Add(new PdfDecoder() { Resolution = 200 }); 
}

VB.NET

Shared Sub New
    RegisteredDecoders.Decoders.Add(New PdfDecoder() With {.Resolution = 200})
End Sub

Also, we have a complete, working PDF to TIFF demo and a complete, working TIFF to PDF Demo available which implement these techniques.

A common task that comes across in the document management world is converting from one file format to another. The two most commonly used formats for digital document images are PDF and TIFF. This task may confuse DotImage developer's because the PDF and TIFF codecs function slightly different from each other. Here I will explain the different approaches to this problem. First, I'll start by explaining the simple case, PDF to TIFF.

There are three possible to save a TIFF file in DotImage; The most memory efficient is demonstrated in the PDF to TIFF demo in our demo gallery. It uses a class called FileSystemImageSource which is passed directly to the PdfEncoder.Save method (along with a stream to save to)

C#

TiffEncoder enc = new TiffEncoder();

using (FileStream fs = new FileStream("pathToSaveTo", FileMode.OpenOrCreate)) 
{
    using (FileSystemImageSource fsis = new FileSystemImageSource("PathToSourceTiff", true)) 
    {
        enc.Save(fs, fsis, null);
    }
}

VB.NET

Dim enc As New TiffEncoder()

Using fs As New FileStream("pathToSaveTo", FileMode.OpenOrCreate)
   Using fsis As New FileSystemImageSource("PathToSourceTiff", True)
      enc.Save(fs, fsis, Nothing)
   End Using
End Using


PDF to TIFF sample app

Original Article:
Q10125 - FAQ: How Do I Convert Between PDF and TIFF