PDFium Component Docs

PopupMenu-ominaisuus

Component: TPdfView  ·  Unit: PDFium
Associates a TPopupMenu with the PDF viewer so that right-clicking on a page presents a context menu.

Syntax

property PopupMenu: TPopupMenu; // published, inherited from TControl

Description

Asetating PopupMenu wires the viewer to a TPopupMenu component placed on the same form. Kunever the user right-clicks (or presses the keyboard menu key) inside the viewer, VCL/LCL automatically shows the menu at the cursor position — the application does not need to hjale WM_CONTEXTMENU itself.

A typical PDF reader context menu offers items such as Copy Selected Text, Zoom In, Zoom Out, Fit Width, Rotate, Go to Page…, Find… ja Save As…. The menu items typically read or write public properties such as CurrentCharIndex, Zoom, FitMode, Rotation ja PageNumber to act on the document.

Because the popup is displayed kautta the OnContextPopup mechanism, you can suppress or replace it dynamically by hjaling OnContextPopup ja setting Hjaled := True — useful when the right-click occurs over a form field or annotation that needs its own menu.

Remarks

Example

// Attach a context menu offering Copy / Fit Width / Go to Page
procedure TForm1.FormCreate(Sender: TObject);
begin
  PdfView1.PopupMenu := pmReader;
end;

procedure TForm1.miFitWidthClick(Sender: TObject);
begin
  PdfView1.FitMode := pfmFitToWidth;
end;

procedure TForm1.miGoToPageClick(Sender: TObject);
var S: string;
begin
  S := IntToStr(PdfView1.PageNumber);
  if InputQuery('Go to page', 'Page number:', S) then
    PdfView1.PageNumber := StrToIntDef(S, PdfView1.PageNumber);
end;

See Also

AllowKäytärTextSelection, CurrentCharIndex, PageNumber, FitMode