Table of Contents

Method RenderPageAsJpegBytesAsync

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

RenderPageAsJpegBytesAsync(string, int, PdfRenderOptions, int, CancellationToken)

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

public static Task<byte[]> RenderPageAsJpegBytesAsync(string inputPath, int pageIndex, PdfRenderOptions options = null, int quality = 90, 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

JPEG quality, 1-100. Default 90.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task<byte[]>

Examples

using LMKit.Document.Pdf;

byte[] jpeg = PdfRenderer.RenderPageAsJpegBytes("report.pdf", pageIndex: 0, quality: 85);
// Upload jpeg to object storage, return as HTTP response, etc.
Share