function GetObjectRenderedStrokePattern(Index: Integer): TBitmap;
| Index | Integer. Zero-based page object index within the range 0 .. ObjectCount - 1 |
| Result | TBitmap. A newly created bitmap owned by the caller, who must free it, or nil when the object is not stroked with a tiling pattern, the native export is missing, or rendering fails |
A path object whose stroke colour space is /Pattern with a PatternType 1 (tiling) pattern paints its outline with a repeated cell rather than a flat colour. This method renders that cell in isolation through the native FPDFPageObj_GetRenderedStrokePattern export, so a caller can inspect, export or preview the pattern without rendering the entire page
The render lock is held for the duration of the native call, so the method is safe against concurrent rendering on the same component. The native bitmap is converted and destroyed before the method returns; the resulting TBitmap belongs to the caller
The call requires the current page to be active. Objects that are not paths, paths stroked with a plain colour or a shading pattern, and fill-only patterns all yield nil rather than raising an exception; use PageObjectInfo or PathInfo to find out why
Coloured tiling patterns (PaintType 1) render using their own colours; uncoloured patterns (PaintType 2) render using whatever stroke colour the content stream has selected
nil result means "no pattern" or "no export"
var
I: Integer;
Bmp: TBitmap;
begin
for I := 0 to Pdf1.ObjectCount - 1 do
begin
Bmp := Pdf1.GetObjectRenderedStrokePattern(I);
if Bmp <> nil then
try
Bmp.SaveToFile(Format('stroke-pattern-%d.bmp', [I]));
finally
Bmp.Free;
end;
end;
end;