Table of Contents

Method SavePageAsBmpAsync

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

SavePageAsBmpAsync(string, int, string, PdfRenderOptions, bool, CancellationToken)

Renders one page and writes it as BMP to a file.

public static Task SavePageAsBmpAsync(string inputPath, int pageIndex, string outputPath, PdfRenderOptions options = null, bool rle = false, 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.

rle bool

When true, BMP output uses RLE compression.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task

Examples

using LMKit.Document.Pdf;

PdfRenderer.SavePageAsBmp("report.pdf", pageIndex: 0, "page-1.bmp");

// RLE-compressed BMP for legacy Windows pipelines
PdfRenderer.SavePageAsBmp("report.pdf", 0, "page-1.bmp", rle: true);

SavePageAsBmpAsync(string, int, Stream, PdfRenderOptions, bool, CancellationToken)

Renders one page and writes it as BMP to a writable stream.

public static Task SavePageAsBmpAsync(string inputPath, int pageIndex, Stream outputStream, PdfRenderOptions options = null, bool rle = false, 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.

rle bool

When true, BMP output uses RLE compression.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task

Examples

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

using MemoryStream output = new();
PdfRenderer.SavePageAsBmp("report.pdf", pageIndex: 0, output);
Share