Copy Document Content

  • 2 minutes to read

The PDF Viewer allows you to select and copy text and an image from the document to the Clipboard.

To enable the selection mode, invoke the context menu and choose the Select Tool item (or set PdfViewer.CursorMode to PdfCursorMode.SelectTool). This mode is active by default.

pdf-viewer-11

To copy an image:

  • select the image or any part of an image;
  • right click the image and select the Copy command in the context menu, or press Ctrl+C;

    CopyImage

  • paste the image into a desired application by choosing the Past command in the context menu, or pressing Ctrl+V.

To copy text:

  • highlight the text you desire;
  • choose the Copy command in the context menu, or press Ctrl+C;

    CopyText

  • paste the content into an application.

To select document content at the specified position in code, call the PdfViewer.Select method. To copy the selected content to the Clipboard, call the PdfViewer.CopyToClipboard method.

To select all text in a document for copying:

  • invoke the context menu;
  • choose the Select All pdf-viewer-select-all command (press Ctrl+A);

    pdf-viewer-10

    or…

  • call the PdfViewer.SelectAllText method.

You can get information about whether or not document content is selected using the PdfViewer.HasSelection property. To obtain selected content in code, call the PdfViewer.GetSelectionContent method.

You can also clear the current selection by calling the PdfViewer.ClearSelection method.

To perform specific actions each time an end-user started, continued or ended the selection of document content, handle PdfViewer.SelectionStarted, PdfViewer.SelectionContinued, and PdfViewer.SelectionEnded events.