Docs PDFiumVCL

Active property

Esta entrada API preserva identificadores, assinaturas, blocos de código e termos PDF em sua forma original.
Component: TPdfView  ·  Unit: PDFium
Activates or deactivates the viewer, opening the bound PDF document and rendering the selected page.

Syntax

property Active: Boolean; // default False

Description

Setting Active to True instructs the viewer to load the document referenced by the associated Pdf component, open the page identified by PageNumber, and trigger a repaint. Setting it to False closes the page, releases the cached text-page handle, drops the find session, and clears the visible area.

Active is the master switch of the viewer. Document-related properties such as PageCount, PageWidth, PageLabel, and the indexed accessors (Character, Bitmap, WebLink, etc.) only return meaningful values while Active is True and the linked Pdf instance has a document loaded.

If Pdf is nil the viewer creates and owns an internal TPdf instance the first time Active is set to True, so a minimal program can simply call PdfView1.Pdf.FileName := ...; PdfView1.Active := True; after pointing it at a file.

Remarks

Example

// Bind to an explicit TPdf and open a file.
PdfView1.Pdf := Pdf1;
Pdf1.FileName := 'C:\docs\sample.pdf';
PdfView1.Active := True;

// React to open/close in code.
if PdfView1.Active then
  StatusBar1.SimpleText := Format('%d pages', [PdfView1.PageCount])
else
  StatusBar1.SimpleText := 'No document loaded';

// Close the viewer.
PdfView1.Active := False;

See Also

Pdf, PageNumber, PageCount, ReloadPage, TPdf.Active