ImageEn, unit iexUserInteractions

TIEPdfViewer.GetBookmarks

TIEPdfViewer.GetBookmarks


Declaration

procedure GetBookmarks(const Dest: TTreeView);


Description

Fills a TTreeView with the bookmarks of the current document.
For each TTreeNode, the caption will be the bookmark title.
The TTreeNode.Data will be an integer value of a document page.



Note: You can use HasBookmarks to determine whether the document has bookmarks.


Demo

Demo  Demos\PDF\PDFViewer\PdfViewer.dpr


Examples

// Prompt user to load a PDF document and retrieve its bookmarks
procedure TfrmMain.btnLoadClick(Sender: TObject);
begin
  if OpenPDF.Execute() then
  begin
    ImageEnView1.PdfViewer.Enabled := True;
    ImageEnView1.IO.LoadFromFile( OpenPDF.Filename );
    ImageEnView1.PdfViewer.GetBookmarks( TreeView1 );
  end;
end;

// When a node is clicked in the TTreeView, navigate to the page
procedure TfrmMain.TreeView1Click(Sender: TObject);
var
  pgIdx: Integer;
begin
  if TreeView1.Selected <> nil then
  begin
    pgIdx := Integer( TreeView1.Selected.Data ); // Page index stored in pointer field as an integer
    if pgIdx >= 0 then
      ImageEnView1.PdfViewer.PageIndex := pgIdx;
  end;
end;