Rendering pages
How PdfView renders pages in a .NET MAUI app, and how to render pages and thumbnails to PNG yourself with the NexPDF engine.
License module
Rendering is part of the viewer module and works without a key. Unlicensed and trial renders carry
a watermark; commercial keys render without one.
In the view
PdfView renders the visible pages, and one on each side, on a background thread at a resolution
that matches the zoom and the screen density. It re-renders when scrolling, pinching or resizing
settles, and keeps the pages near the current one cached.
view.SetZoom(1); // fit the page width (the default)
view.SetZoom(3); // between PdfView.MinZoom (0.5) and PdfView.MaxZoom (5.0)
var z = view.Zoom;Render to PNG yourself
For thumbnails, sharing or printing, render with the engine. RenderPagePng(pageIndex, dpi) returns
PNG bytes (72 dpi is one pixel per point); RenderThumbPng(pageIndex, maxDim) fits the page into a
square of maxDim pixels.
var doc = view.Document!;
var png = await Task.Run(() => doc.RenderThumbPng(0, 256));
ThumbImage.Source = ImageSource.FromStream(() => new MemoryStream(png));Render from your own NexPdfDocument when the view may be rendering at the same time: a document is
used by one thread at a time, and the view does not lock Document for your calls.
using var doc = NexPdfDocument.OpenBytes(pdfBytes);
var thumbs = Enumerable.Range(0, doc.PageCount).Select(i => doc.RenderThumbPng(i, 160)).ToList();Map a tap to a PDF point
doc.PageView(i) returns a NexPdfPageView that converts between pixels and PDF points, with
rotation and crop applied. scale is pixels per point:
var page = doc.PageView(0);
double scale = imageWidth / page.Width;
var (x, y) = page.ToPdf(tap.X, tap.Y, scale);See the .NET rendering guide for overprint simulation and memory control.