Flutter-docs/Flutter/pdf-viewer/interaction-modes.md

2.1 KiB

layout title description platform control documentation
post Interaction modes in Flutter PDF Viewer widget | Syncfusion Learn here all about interaction modes feature of Syncfusion Flutter PDF Viewer (SfPdfViewer) widget and more. Flutter SfPdfViewer ug

Interaction modes in Flutter PDF Viewer (SfPdfViewer)

The SfPdfViewer supports the following interaction modes for easy interaction with the PDF documents on a desktop web browser,

  • selection
  • pan

N> On a touch device, setting the interactionMode property to the selection mode will have no effect since panning is the default mode for scrolling and the selection is made by long-pressing a word in the document.

Selection mode

By default, the selection interaction mode will be enabled on a desktop web browser and allows users to select and copy text from the PDF files. This also helps to copy and share the text content. Refer to the following code to enable the selection mode in SfPdfViewer.

{% tabs %} {% highlight Dart %}

@override Widget build(BuildContext context) { return Scaffold( body: Container( child: SfPdfViewer.network( 'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf', interactionMode: PdfInteractionMode.selection))); }

{% endhighlight %} {% endtabs %}

Pan mode

In pan mode, the dragging and scrolling of the pages can be performed in any direction using the mouse and touch interactions on a desktop web browser, but the text selection cannot be performed. Refer to the following code to enable the pan mode in SfPdfViewer.

{% tabs %} {% highlight Dart %}

@override Widget build(BuildContext context) { return Scaffold( body: Container( child: SfPdfViewer.network( 'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf', interactionMode: PdfInteractionMode.pan))); }

{% endhighlight %} {% endtabs %}