Method SavePageAsPnmAsync
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
inputPathstringPath to the source PDF.
pageIndexintZero-based index of the page to render.
outputPathstringDestination file path.
optionsPdfRenderOptionsRender options.
cancellationTokenCancellationTokenCancels the operation.
Returns
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
inputPathstringPath to the source PDF.
pageIndexintZero-based index of the page to render.
outputStreamStreamWritable destination stream.
optionsPdfRenderOptionsRender options.
cancellationTokenCancellationTokenCancels the operation.
Returns
Examples
using System.IO;
using LMKit.Document.Pdf;
using FileStream output = File.Create("page-1.pnm");
PdfRenderer.SavePageAsPnm("report.pdf", pageIndex: 0, output);