RenderPageTilesToFiles
Rendering, parallel processing, tiled rendering
Description
Splits one rendered page into an exact device-pixel grid, prewarms one parsed display list, and writes the remaining tiles through up to MaxWorkers concurrent workers
The pattern accepts %x for the zero-based column, %y for the zero-based row and %i for the row-major tile index
Syntax
Function RenderPageTilesToFiles(DPI: Double; Page, TileWidth, TileHeight, Overlap, Options, BackgroundMode: Integer; BackgroundColor: Cardinal; Const OutputPattern: WideString; MaxWorkers: Integer): Integer;Parameters
| DPI | Render resolution in dots per inch, scaled by the library render scale |
|---|---|
| Page | One-based page number to split into tiles |
| TileWidth, TileHeight | Positive core tile dimensions in device pixels |
| Overlap | Extra pixels requested on each available edge; it must be non-negative and smaller than both tile dimensions |
| Options | Raster format constant for BMP, JPEG, PNG, GIF, TIFF or G4 TIFF |
| BackgroundMode | PDF_TILE_BACKGROUND_WHITE, PDF_TILE_BACKGROUND_TRANSPARENT or PDF_TILE_BACKGROUND_CUSTOM |
| BackgroundColor | Custom fill or PNG transparency-key colour |
| OutputPattern | Destination name pattern with %x for the zero-based column, %y for the zero-based row and %i for the row-major tile index; without placeholders the index is inserted before the filename extension |
| MaxWorkers | Maximum concurrent workers; 0 selects the processor count, and older compilers and FPC always run the serial path |
Return values
The number of tile files written successfully
Remarks
A tile destination that cannot be opened is not counted as successful, and an existing file at that path is preserved; other writable tiles can still complete
The expanded names must be unique across the complete tile grid; colliding names reject the operation before any file is written, with details in LastRenderError
Use %i, or separate %x and %y values, for a two-dimensional grid; without placeholders, the tile index is inserted before the filename extension
A zero worker count selects the processor count on supported Delphi versions, while older compilers and FPC use the deterministic serial path