Table of Contents

Method SavePageAsTiff

Namespace
LMKit.Document.Pdf
Assembly
LM-Kit.NET.dll

SavePageAsTiff(string, int, string, PdfRenderOptions, CancellationToken)

Renders one page and writes it as a single-page TIFF to a file.

public static void SavePageAsTiff(string inputPath, int pageIndex, string outputPath, PdfRenderOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

pageIndex int

Zero-based index of the page to render.

outputPath string

Destination file path.

options PdfRenderOptions

Render options.

cancellationToken CancellationToken

Cancels the operation.

Examples

using LMKit.Document.Pdf;
using LMKit.Media.Image;

// Archival 300 DPI grayscale TIFF (per-page; for packed multi-page TIFF
// use SavePagesAsMultipageTiff).
PdfRenderOptions options = new()
{
    Zoom = 300.0 / 72.0,
    PixelFormat = ImagePixelFormat.GRAY8,
};
PdfRenderer.SavePageAsTiff("scan.pdf", pageIndex: 0, "archive-1.tif", options);

SavePageAsTiff(string, int, Stream, PdfRenderOptions, CancellationToken)

Renders one page and writes it as single-page TIFF to a writable stream.

public static void SavePageAsTiff(string inputPath, int pageIndex, Stream outputStream, PdfRenderOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

pageIndex int

Zero-based index of the page to render.

outputStream Stream

Writable destination stream.

options PdfRenderOptions

Render options.

cancellationToken CancellationToken

Cancels the operation.

Examples

using System.IO;
using LMKit.Document.Pdf;

using FileStream output = File.Create("page-1.tif");
PdfRenderer.SavePageAsTiff("scan.pdf", pageIndex: 0, output);
Share