Docs de PDFiumVCL

Transparent property

Esta entrada API conserva identificadores, firmas, bloques de código y términos PDF en su forma original.
Component: TPdf  ·  Unit: PDFium
Whether the currently active page contains transparent content.

Syntax

property Transparent: Boolean; // read only

Description

Transparent returns True when the active page contains any object whose effective alpha is less than 1.0 or which references a graphics state that enables transparency — soft masks, opacity values (CA / ca), non-default blend modes (/BM), or transparency groups (PDF 1.7 spec section 11). It is the same flag PDFium checks internally to decide whether the page must be rendered through its transparent-page rasterizer.

The property is False when Active is False or when the page is purely opaque. Pages that are transparent are slightly more expensive to render — PDFium has to allocate an alpha channel and composite each object against the page background — so detecting transparency up front lets callers pick the right output target (32-bit ARGB TBitmap, PDF watermark overlay, printer’s alpha-aware path).

The value is a per-page property; iterate every page if you need a document-wide “has transparency anywhere?” answer. Combine with the Background color when rendering to a flat bitmap: a transparent page on a clWhite background produces flattened output, whereas rendering on a transparent surface preserves alpha for downstream compositing.

Remarks

Example

var Bmp: TBitmap;
Bmp := TBitmap.Create;
try
  if Pdf1.Transparent then
    Bmp.PixelFormat := pf32bit
  else
    Bmp.PixelFormat := pf24bit;
  Pdf1.RenderToBitmap(Bmp, 1.0);
finally
  Bmp.Free;
end;

See Also

Active, PageNumber, ObjectTransparent, RenderPage