Table of Contents

Method RenderPageAsPngBytes

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

RenderPageAsPngBytes(string, int, PdfRenderOptions, int, CancellationToken)

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

public static byte[] RenderPageAsPngBytes(string inputPath, int pageIndex, PdfRenderOptions options = null, int compressionLevel = 6, 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.

compressionLevel int

PNG compression level 0-9. Default 6.

cancellationToken CancellationToken

Cancels the operation.

Returns

byte[]

Examples

using LMKit.Document.Pdf;

// Render and ship via HTTP, message bus, or cache without touching disk.
byte[] png = PdfRenderer.RenderPageAsPngBytes("report.pdf", pageIndex: 0);
// e.g. return File(png, "image/png");
Share