Method SavePageAsTiff
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
inputPathstringPath to the source PDF.
pageIndexintZero-based index of the page to render.
outputPathstringDestination file path.
optionsPdfRenderOptionsRender options.
cancellationTokenCancellationTokenCancels 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
inputPathstringPath to the source PDF.
pageIndexintZero-based index of the page to render.
outputStreamStreamWritable destination stream.
optionsPdfRenderOptionsRender options.
cancellationTokenCancellationTokenCancels 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);