property Active: Boolean; // default False
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
Assign a TPdf component to Pdf before setting Active to True. If Pdf is nil or the underlying document fails to open, the viewer remains inactive without raising an exception
False before reassigning Pdf at runtime; changing Pdf while active raises EPdfErrorTrue without a valid source leaves Active as False rather than raising an exception; inspect Pdf.LastLoadReport for failure details// 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;