Tiff Conversion Guide
This guide covers PDF-to-TIFF conversion using the Tiff class in Aspose.PDF for .NET.
Setup
Apply metered licensing before processing:
using Aspose.Pdf;
Metered metered = new Metered();
metered.SetMeteredKey("publicKey", "privateKey");Prerequisites
- A PDF you want to convert to TIFF.
- Valid Aspose Metered API key.
Step 1: Convert a Multi-Page PDF to a Single TIFF
Set TiffOptions.SaveAsMultiPageTiff to true and call Process; the output has one frame per PDF page.
using System.Linq;
using Aspose.Pdf.LowCode;
var tiff = new Tiff();
var options = new TiffOptions { SaveAsMultiPageTiff = true };
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("tiff-output"));
var result = tiff.Process(options);
tiff.Dispose();
string outputPath = result.ResultCollection.First().ToFile();Step 2: Choose a Compression Type
Compression accepts None, RLE, LZW, CCITT3, or CCITT4; CCITT3 and CCITT4 are typically paired with Depth set to Format1bpp for fax-style output.
using System.Linq;
using Aspose.Pdf.LowCode;
using Aspose.Pdf.Devices;
var tiff = new Tiff();
var options = new TiffOptions
{
SaveAsMultiPageTiff = true,
Compression = CompressionType.CCITT4,
Depth = ColorDepth.Format1bpp,
};
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("tiff-output"));
var result = tiff.Process(options);
tiff.Dispose();
string outputPath = result.ResultCollection.First().ToFile();Step 3: Convert Only Specific Pages, at a Specific Resolution
PageList restricts conversion to a subset of pages, and OutputResolution sets the output DPI; both are inherited from PdfToImageOptions. PageList is null by default, so assign a new list rather than calling .Add() on it directly.
using System.Collections.Generic;
using System.Linq;
using Aspose.Pdf.LowCode;
var tiff = new Tiff();
var options = new TiffOptions
{
SaveAsMultiPageTiff = true,
OutputResolution = 300,
PageList = new List<int> { 1, 2 },
};
options.AddInput(new FileDataSource("input.pdf"));
options.AddOutput(new FileDataSource("tiff-output"));
var result = tiff.Process(options);
tiff.Dispose();
string outputPath = result.ResultCollection.First().ToFile();Step 4: Convert from an In-Memory Stream
AddInput accepts StreamDataSource for in-memory processing, converting a PDF held entirely in memory without writing it to disk first.
using System.IO;
using System.Linq;
using Aspose.Pdf.LowCode;
using var inputStream = File.OpenRead("input.pdf");
var tiff = new Tiff();
var options = new TiffOptions { SaveAsMultiPageTiff = true };
options.AddInput(new StreamDataSource(inputStream));
options.AddOutput(new FileDataSource("tiff-output"));
var result = tiff.Process(options);
tiff.Dispose();
string outputPath = result.ResultCollection.First().ToFile();Format Support
The Tiff class converts any valid PDF input to TIFF image output, as either one multi-page file or one file per page depending on SaveAsMultiPageTiff.
Troubleshooting
| Problem | Likely Cause | Fix |
|---|---|---|
The TIFF file isn’t at the path passed to AddOutput | AddOutput’s FileDataSource path is used as an output DIRECTORY, not a file path – the engine writes the real file inside it with an auto-generated name | Read the actual output path back from the result’s FileResult.ToFile(), rather than assuming it’s the path you passed to AddOutput |
SkipBlankPages doesn’t seem to reduce the frame count on a PDF with blank pages | Probed directly against Aspose.PDF 26.10.0: no frame-count reduction was observed, with or without blank pages present | Don’t rely on SkipBlankPages; filter pages yourself with PageList if you need to skip specific ones |
A null-reference error when calling .Add() on PageList | PageList is null by default; it is a settable property, not a pre-initialized collection | Assign a new list to PageList before using it, instead of calling .Add() on its default value |
| An evaluation watermark appears in the output TIFF | Metered licensing was not applied before calling the plugin | Call the Metered setup shown in Setup above before using Tiff |