Table of Contents

Method Render

Namespace
LMKit.Data
Assembly
LM-Kit.NET.dll

Render(double, int)

Renders a page of this attachment as an image at the specified zoom level.

public ImageBuffer Render(double zoom = 1, int pageIndex = 0)

Parameters

zoom double

The zoom factor relative to the document's native resolution. A value of 1.0 renders at 72 DPI; 2.0 renders at 144 DPI.

pageIndex int

Zero-based page index. Default is 0 (first page).

Returns

ImageBuffer

A new ImageBuffer containing the rendered page in RGB24 format.

Examples

using LMKit.Data;
using LMKit.Media.Image;

var attachment = new Attachment("report.pdf");
using ImageBuffer page = attachment.Render(zoom: 2.0, pageIndex: 0);
byte[] jpeg = page.SaveAsJpegBytes(quality: 90);

Remarks

For PDF attachments, the page is rasterized at the given zoom factor (1.0 = 72 DPI). For image attachments (including multi-page TIFF), the specified page is extracted and scaled according to the zoom factor.

The returned ImageBuffer must be disposed by the caller.

Exceptions

NotImplementedException

Thrown when the attachment format does not support rendering.

Share