Copy Document Content

  • 2 min to read

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

To enable the selection mode, invoke the context menu and choose the Select tool item (or set PdfViewerControl.CursorMode to CursorModeType.SelectTool).

SelectToolMenu

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 PdfViewerControl.Select method. To copy the selected content to clipboard, execute PdfViewerControl.CopyCommand.

To select all text in a document for copying:

SelectAll

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

You can also clear the current selection by calling the PdfViewerControl.UnselectAll method.

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