PDFiumVCL Docs

CopySelectionToClipboard function

Component: TPdfView  ·  Unit: PDFium
Copies the currently selected text to the Windows clipboard as CF_UNICODETEXT.

Syntax

function CopySelectionToClipboard: Boolean;

Description

Pulls the current selection through SelectedText and writes it onto the Windows clipboard as CF_UNICODETEXT via OpenClipboard / EmptyClipboard / GlobalAlloc / SetClipboardData. Returns True on success.

Returns False when there is no selection to copy, when SelectedText resolves to the empty string, or when any of the Win32 clipboard calls fail (e.g. another process holds the clipboard, GlobalAlloc fails, OOM). Defensive on every step — never raises.

Remarks

Example

if not PdfView1.CopySelectionToClipboard then
  ShowMessage('Nothing selected, or clipboard unavailable.');

See Also

SelectedText, HasSelection, SelectAll, ClearSelection