Table of Contents

Method RenderPageAsWebpBytesAsync

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

RenderPageAsWebpBytesAsync(string, int, PdfRenderOptions, int, CancellationToken)

Renders one page and returns it as a WebP-encoded byte array.

public static Task<byte[]> RenderPageAsWebpBytesAsync(string inputPath, int pageIndex, PdfRenderOptions options = null, int quality = 80, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

pageIndex int

Zero-based index of the page to render.

options PdfRenderOptions

Render options.

quality int

WebP quality, 1-100. Default 80.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<byte[]>

Examples

using LMKit.Document.Pdf;

byte[] webp = PdfRenderer.RenderPageAsWebpBytes("report.pdf", pageIndex: 0, quality: 80);
// ~30% smaller than equivalent JPEG; ideal for web image CDNs.
Share