function RenderPageProgressive(
Bitmap : TBitmap;
Left, Top, Width, Height: Integer;
const AToken : IPdfCancellationToken;
Rotation : TRotation = ro0;
Options : TRenderOptions = [];
Color : TColor = clWhite): TPdfProgressiveStatus;
Color = clNone or Color = clDefault selects a transparent background and an alpha-capable PDFium bitmap. Uncovered pixels retain zero alpha independently of the native page background-transparency query, including partially rendered results returned after cancellation; clWhite remains the default opaque background
RenderPageProgressive renders the current page into the supplied
Bitmap using PDFium's
FPDF_RenderPageBitmap_Start +
FPDF_RenderPage_Continue loop. Between iterations,
PDFium's IFSDK_PAUSE callback polls
AToken.IsCancelled — when the application has
cancelled, the loop unwinds cleanly and the bitmap holds the
partial work done so far
PDFium renders directly into a compatible destination bitmap buffer. Native LCL buffers must also have the expected byte order, channel shifts, line order and stride; other layouts are converted using their actual raw-image description
The return value identifies how the render finished:
FPDF_RENDER_FAILED. The bitmap state is undefinedPass AToken = nil to render to completion without
ever pausing. In that case the function still pumps
FPDF_RenderPage_Continue until DONE but never returns
prsCancelled. This is useful when the caller wants the
progressive loop's intermediate redraw points (a custom OnPaint
that mirrors the in-progress bitmap) but does not need cancellation
pf32bit; native LCL bitmaps retain their platform description and use direct rendering only when the actual buffer layout is compatibleTPdf serializes render calls per instance; callers still must avoid mutating or unloading the document while a render is in flightEPdfError is raised when Bitmap is nil — the contract requires a caller-allocated bitmap because the zero-copy path needs a known DIB layout
uses FPdfAsync;
var
Bitmap: TBitmap;
Status: TPdfProgressiveStatus;
begin
Bitmap := TBitmap.Create;
try
Bitmap.PixelFormat := pf32bit;
Bitmap.SetSize(2480, 3508); // A4 @ 300 DPI
Status := Pdf1.RenderPageProgressive(Bitmap,
0, 0, Bitmap.Width, Bitmap.Height,
CancelToken, ro0, [reAnnotations]);
case Status of
prsDone: SaveBitmap(Bitmap);
prsCancelled: Log.Add('Cancelled mid-page');
prsFailed: Log.Add('PDFium FPDF_RENDER_FAILED');
end;
finally
Bitmap.Free;
end;
end;