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 |
| Rotation | TRotation. Display rotation applied to the page |
| Options | TRenderOptions. Rendering flags |
| Color | TColor. Background fill applied to each band before rendering |
| Result | TPdfBandedImageReport. Band counts, encoded rows, peak band bytes, output bytes, completion flag, and the selected format |
The method wraps the stream in the requested built-in encoder, TPdfPngBandedImageEncoder or TPdfTiffBandedImageEncoder, and drives the shared banded pipeline of RenderPageBandedToEncoder. The returned report carries the selected Format instead of pbifCustom
The PNG encoder compresses each scanline directly into sequential IDAT chunks, while the TIFF encoder writes one RGB strip per render band and appends its image file directory after the pixel data. Both encoders write forward only and never seek the caller stream
Peak page pixel storage is one Width x BandHeight BGRA bitmap rather than Width x Height. The report exposes the measured PeakBandBytes so exporters can audit the memory policy, and OutputBytes reflects what was actually written to the stream
Use TPdfBandedImageStreamOptions.Default(pbifPng) or Default(pbifTiff) before overriding individual limits; the defaults are BandHeight = 256, CompressionLevel = 6, and MaxOutputBytes = 0
A nil stream, a non-positive BandHeight, or a negative MaxOutputBytes raises EPdfError, and pbifCustom is rejected because a built-in PNG or TIFF format is required
When the encoded image would exceed MaxOutputBytes, the write raises EPdfError with the message Encoded image exceeds the output byte budget
Use RenderPageBandedToEncoder with a custom TPdfBandedImageEncoder descendant for any other container format or for external codecs
StreamOptions := TPdfBandedImageStreamOptions.Default(pbifTiff);
StreamOptions.BandHeight := 256;
StreamOptions.MaxOutputBytes := Int64(512) * 1024 * 1024;
Report := Pdf.RenderPageBandedToStream(OutputStream, 4960, 7016,
StreamOptions);
if not Report.Completed then
RaiseBandedExportIncomplete;