Table of Contents

Method SavePageAsPnmAsync

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

SavePageAsPnmAsync(string, int, string, PdfRenderOptions, CancellationToken)

Renders one page and writes it as PNM (Netpbm) to a file.

public static Task SavePageAsPnmAsync(string inputPath, int pageIndex, string outputPath, PdfRenderOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

pageIndex int

Zero-based index of the page to render.

outputPath string

Destination file path.

options PdfRenderOptions

Render options.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task

Examples

using LMKit.Document.Pdf;

// PNM is friendly to Netpbm / ImageMagick pipelines on Linux
PdfRenderer.SavePageAsPnm("report.pdf", pageIndex: 0, "page-1.pnm");

SavePageAsPnmAsync(string, int, Stream, PdfRenderOptions, CancellationToken)

Renders one page and writes it as PNM (Netpbm) to a writable stream.

public static Task SavePageAsPnmAsync(string inputPath, int pageIndex, Stream outputStream, PdfRenderOptions options = null, CancellationToken cancellationToken = default)

Parameters

inputPath string

Path to the source PDF.

pageIndex int

Zero-based index of the page to render.

outputStream Stream

Writable destination stream.

options PdfRenderOptions

Render options.

cancellationToken CancellationToken

Cancels the operation.

Returns

Task

Examples

using System.IO;
using LMKit.Document.Pdf;

using FileStream output = File.Create("page-1.pnm");
PdfRenderer.SavePageAsPnm("report.pdf", pageIndex: 0, output);
Share