Method RenderPageAsJpegBytesAsync
RenderPageAsJpegBytesAsync(string, int, PdfRenderOptions, int, CancellationToken)
Renders one page and returns it as a JPEG-encoded byte array.
public static Task<byte[]> RenderPageAsJpegBytesAsync(string inputPath, int pageIndex, PdfRenderOptions options = null, int quality = 90, CancellationToken cancellationToken = default)
Parameters
inputPathstringPath to the source PDF.
pageIndexintZero-based index of the page to render.
optionsPdfRenderOptionsRender options.
qualityintJPEG quality,
1-100. Default90.cancellationTokenCancellationTokenCancels the operation.
Returns
Examples
using LMKit.Document.Pdf;
byte[] jpeg = PdfRenderer.RenderPageAsJpegBytes("report.pdf", pageIndex: 0, quality: 85);
// Upload jpeg to object storage, return as HTTP response, etc.