Table of Contents

Method RenderPage

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

RenderPage(Attachment, int, double)

Renders a single page from a PDF attachment as an image.

public static ImageBuffer RenderPage(Attachment source, int pageIndex, double zoom = 2)

Parameters

source Attachment

The source PDF attachment.

pageIndex int

Zero-based page index to render.

zoom double

Zoom factor for rendering. Default is 2.0. Higher values produce larger, higher-resolution images.

Returns

ImageBuffer

An ImageBuffer containing the rendered page.

Examples

using LMKit.Data;
using LMKit.Document.Pdf;

var source = new Attachment("report.pdf");
using var image = PdfToImage.RenderPage(source, 0, zoom: 3.0);
image.SaveAsPng("page1_hires.png");

Exceptions

ArgumentNullException

Thrown when source is null.

ArgumentException

Thrown when the source attachment is not a PDF.

ArgumentOutOfRangeException

Thrown when pageIndex is out of range.

RenderPage(string, int, double)

Renders a single page from a PDF file as an image.

public static ImageBuffer RenderPage(string inputPath, int pageIndex, double zoom = 2)

Parameters

inputPath string

Path to the source PDF file.

pageIndex int

Zero-based page index to render.

zoom double

Zoom factor for rendering. Default is 2.0. Higher values produce larger, higher-resolution images.

Returns

ImageBuffer

An ImageBuffer containing the rendered page.

Examples

using LMKit.Document.Pdf;

using var image = PdfToImage.RenderPage("report.pdf", 0, zoom: 3.0);
image.SaveAsJpeg("page1.jpg", quality: 95);

Exceptions

ArgumentNullException

Thrown when inputPath is null.

FileNotFoundException

Thrown when inputPath does not exist.

ArgumentOutOfRangeException

Thrown when pageIndex is out of range.