function RenderPageBanded(Width, Height, BandHeight: Integer; BandCallback: TPdfBandCallback; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TColor = clWhite): Integer;
| Width, Height | Integer. Size of the full page image in pixels, as if it were rendered in one piece |
| BandHeight | Integer. Height of each band in pixels. The last band is shorter when Height is not a multiple of it |
| BandCallback | TPdfBandCallback. Method called once per band as function(BandIndex, BandTopY: Integer; Bitmap: TBitmap): Boolean of object. Return False to cancel the render early |
| Rotation | TRotation. Display rotation applied to the page: ro0, ro90, ro180 or ro270 |
| Options | TRenderOptions. Rendering flags |
| Color | TColor. Background fill applied to each band before rendering |
| Result | Integer. Number of bands actually rendered, or 0 on failure |
function RenderPageBandedToEncoder(Width, Height, BandHeight: Integer; Encoder: TPdfBandedImageEncoder; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TColor = clWhite): TPdfBandedImageReport;
The caller owns Encoder and implements BeginImage, WriteBand and EndImage. Bands arrive from top to bottom with zero-based indices and full-page BandTopY coordinates
WriteBand returns True to continue or False to stop cleanly. The bitmap is valid only during the call. GetBytesWritten may return encoder-specific output telemetry
The result reports rendered and accepted bands in BandsRendered and BandsEncoded, encoded rows in RowsEncoded, peak BGRA band bytes in PeakBandBytes, output bytes and whether every requested row completed
function RenderPageBandedToStream(Stream: TStream; Width, Height: Integer; const StreamOptions: TPdfBandedImageStreamOptions; Rotation: TRotation = ro0; Options: TRenderOptions = []; Color: TColor = clWhite): TPdfBandedImageReport;
| Stream | TStream. Caller-owned writable output positioned where the image begins |
| StreamOptions.Format | pbifPng for compressed 8-bit RGB PNG or pbifTiff for uncompressed little-endian classic TIFF strips |
| StreamOptions.BandHeight | Positive band and TIFF strip height; the default is 256 rows |
| StreamOptions.CompressionLevel | PNG zlib level from 0 through 9; the default is 6 and TIFF ignores it |
| StreamOptions.MaxOutputBytes | Hard encoded byte ceiling; zero means unlimited |
Both built-in encoders write forward only and do not seek the caller stream. PNG compresses each scanline directly into sequential IDAT chunks, whilst TIFF writes one RGB strip per render band and appends its directory after the pixels
Peak page pixel storage is one Width x BandHeight BGRA bitmap rather than Width x Height. The report exposes the measured peak band bytes so exporters can enforce and audit memory policy
Use TPdfBandedImageStreamOptions.Default(pbifPng) or Default(pbifTiff) before overriding individual limits
Posters, maps and engineering drawings can exceed the memory a full-page bitmap would need at print resolution. Banding keeps peak memory at one band instead: each band is rendered into a fresh bitmap of Width x BandHeight and handed to the callback
The callback receives the zero-based band index and BandTopY, the y-offset of the band top in full-page pixels, which is what a writer needs to place the strip in an output file. Each bitmap keeps the complete page device transform and is clipped to that coordinate range. The bitmap belongs to the render loop and is freed after the callback returns, so a callback that needs to keep the pixels has to copy them
Returning False from the callback stops the loop; the return value then counts the bands that were rendered before the cancellation
function TForm1.WriteBand(BandIndex, BandTopY: Integer;
Bitmap: TBitmap): Boolean;
begin
Bitmap.SaveToFile(Format('band%d.bmp', [BandIndex]));
Result := True;
end;
Pdf.RenderPageBanded(4960, 7016, 512, WriteBand);
StreamOptions := TPdfBandedImageStreamOptions.Default(pbifPng);
StreamOptions.BandHeight := 256;
StreamOptions.MaxOutputBytes := 256 * 1024 * 1024;
Report := Pdf.RenderPageBandedToStream(OutputStream, 4960, 7016,
StreamOptions);