Method SavePagesAsWebpsAsync
SavePagesAsWebpsAsync(string, string, PdfRenderOptions, int, string, IProgress<PdfRenderProgressEventArgs>, CancellationToken)
Renders the selected pages and writes one WebP per page.
public static Task<IReadOnlyList<string>> SavePagesAsWebpsAsync(string inputPath, string outputDirectory, PdfRenderOptions options = null, int quality = 80, string fileNamePrefix = "page", IProgress<PdfRenderProgressEventArgs> progress = null, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the source PDF.
outputDirectorystringFolder to write the per-page output files into. Created if missing.
optionsPdfRenderOptionsRender options.
qualityintWebP quality,
1-100. Default80.fileNamePrefixstringPrefix for each output filename. Files are named
{prefix}-{1-based page}.webp.progressIProgress<PdfRenderProgressEventArgs>Optional progress callback fired after each saved page.
cancellationTokenCancellationTokenCancels the operation between pages.
Returns
Examples
using LMKit.Document.Pdf;
IReadOnlyList<string> files = PdfRenderer.SavePagesAsWebps(
"report.pdf", outputDirectory: "webp-previews", quality: 80);