Table of Contents

Method SavePagesAsWebps

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

SavePagesAsWebps(string, string, PdfRenderOptions, int, string, IProgress<PdfRenderProgressEventArgs>, CancellationToken)

Renders the selected pages and writes one WebP per page.

public static IReadOnlyList<string> SavePagesAsWebps(string inputPath, string outputDirectory, PdfRenderOptions options = null, int quality = 80, string fileNamePrefix = "page", IProgress<PdfRenderProgressEventArgs> progress = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

outputDirectory string

Folder to write the per-page output files into. Created if missing.

options PdfRenderOptions

Render options.

quality int

WebP quality, 1-100. Default 80.

fileNamePrefix string

Prefix for each output filename. Files are named {prefix}-{1-based page}.webp.

progress IProgress<PdfRenderProgressEventArgs>

Optional progress callback fired after each saved page.

cancellationToken CancellationToken

Cancels the operation between pages.

Returns

IReadOnlyList<string>

Examples

using LMKit.Document.Pdf;

IReadOnlyList<string> files = PdfRenderer.SavePagesAsWebps(
    "report.pdf", outputDirectory: "webp-previews", quality: 80);
Share