SfPdfViewer.network constructor

SfPdfViewer.network(
  1. String src, {
  2. Key? key,
  3. Map<String, String>? headers,
  4. bool canShowScrollHead = true,
  5. double pageSpacing = 4,
  6. PdfViewerController? controller,
  7. UndoHistoryController? undoController,
  8. PdfZoomLevelChangedCallback? onZoomLevelChanged,
  9. bool canShowPageLoadingIndicator = true,
  10. bool canShowScrollStatus = true,
  11. PdfPageChangedCallback? onPageChanged,
  12. bool enableDoubleTapZooming = true,
  13. bool enableTextSelection = true,
  14. PdfTextSelectionChangedCallback? onTextSelectionChanged,
  15. PdfHyperlinkClickedCallback? onHyperlinkClicked,
  16. PdfDocumentLoadedCallback? onDocumentLoaded,
  17. PdfDocumentLoadFailedCallback? onDocumentLoadFailed,
  18. PdfGestureTapCallback? onTap,
  19. PdfFormFieldValueChangedCallback? onFormFieldValueChanged,
  20. PdfFormFieldFocusChangeCallback? onFormFieldFocusChange,
  21. PdfAnnotationCallback? onAnnotationAdded,
  22. PdfAnnotationCallback? onAnnotationSelected,
  23. PdfAnnotationCallback? onAnnotationDeselected,
  24. PdfAnnotationCallback? onAnnotationEdited,
  25. PdfAnnotationCallback? onAnnotationRemoved,
  26. bool enableDocumentLinkAnnotation = true,
  27. bool canShowPaginationDialog = true,
  28. bool canShowSignaturePadDialog = true,
  29. Offset initialScrollOffset = Offset.zero,
  30. double initialZoomLevel = 1,
  31. int initialPageNumber = 1,
  32. double maxZoomLevel = 3,
  33. PdfInteractionMode interactionMode = PdfInteractionMode.selection,
  34. PdfScrollDirection? scrollDirection,
  35. PdfPageLayoutMode pageLayoutMode = PdfPageLayoutMode.continuous,
  36. Color currentSearchTextHighlightColor = const Color.fromARGB(80, 249, 125, 0),
  37. Color otherSearchTextHighlightColor = const Color.fromARGB(50, 255, 255, 1),
  38. String? password,
  39. bool canShowPasswordDialog = true,
  40. bool canShowHyperlinkDialog = true,
  41. bool enableHyperlinkNavigation = true,
  42. bool canShowTextSelectionMenu = true,
})

Creates a widget that displays the PDF document obtained from the network.

class MyAppState extends State<MyApp>{
@override
void initState() {
  super.initState();
}

@override
Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SfPdfViewer.network(
          'http://ebooks.syncfusion.com/downloads/flutter-succinctly/flutter-succinctly.pdf',
        ),
      ),
    );
  }
}

Implementation

SfPdfViewer.network(
  String src, {
  Key? key,
  Map<String, String>? headers,
  this.canShowScrollHead = true,
  this.pageSpacing = 4,
  this.controller,
  this.undoController,
  this.onZoomLevelChanged,
  this.canShowPageLoadingIndicator = true,
  this.canShowScrollStatus = true,
  this.onPageChanged,
  this.enableDoubleTapZooming = true,
  this.enableTextSelection = true,
  this.onTextSelectionChanged,
  this.onHyperlinkClicked,
  this.onDocumentLoaded,
  this.onDocumentLoadFailed,
  this.onTap,
  this.onFormFieldValueChanged,
  this.onFormFieldFocusChange,
  this.onAnnotationAdded,
  this.onAnnotationSelected,
  this.onAnnotationDeselected,
  this.onAnnotationEdited,
  this.onAnnotationRemoved,
  this.enableDocumentLinkAnnotation = true,
  this.canShowPaginationDialog = true,
  this.canShowSignaturePadDialog = true,
  this.initialScrollOffset = Offset.zero,
  this.initialZoomLevel = 1,
  this.initialPageNumber = 1,
  this.maxZoomLevel = 3,
  this.interactionMode = PdfInteractionMode.selection,
  this.scrollDirection,
  this.pageLayoutMode = PdfPageLayoutMode.continuous,
  this.currentSearchTextHighlightColor =
      const Color.fromARGB(80, 249, 125, 0),
  this.otherSearchTextHighlightColor = const Color.fromARGB(50, 255, 255, 1),
  this.password,
  this.canShowPasswordDialog = true,
  this.canShowHyperlinkDialog = true,
  this.enableHyperlinkNavigation = true,
  this.canShowTextSelectionMenu = true,
})  : _provider = NetworkPdf(src, headers),
      assert(pageSpacing >= 0),
      assert(!maxZoomLevel.isNaN),
      assert(maxZoomLevel >= 1),
      super(key: key);