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. PdfZoomLevelChangedCallback? onZoomLevelChanged,
  8. bool canShowPageLoadingIndicator = true,
  9. bool canShowScrollStatus = true,
  10. PdfPageChangedCallback? onPageChanged,
  11. bool enableDoubleTapZooming = true,
  12. bool enableTextSelection = true,
  13. PdfTextSelectionChangedCallback? onTextSelectionChanged,
  14. PdfHyperlinkClickedCallback? onHyperlinkClicked,
  15. PdfDocumentLoadedCallback? onDocumentLoaded,
  16. PdfDocumentLoadFailedCallback? onDocumentLoadFailed,
  17. PdfGestureTapCallback? onTap,
  18. PdfFormFieldValueChangedCallback? onFormFieldValueChanged,
  19. PdfFormFieldFocusChangeCallback? onFormFieldFocusChange,
  20. bool enableDocumentLinkAnnotation = true,
  21. bool canShowPaginationDialog = true,
  22. bool canShowSignaturePadDialog = true,
  23. Offset initialScrollOffset = Offset.zero,
  24. double initialZoomLevel = 1,
  25. double maxZoomLevel = 3,
  26. PdfInteractionMode interactionMode = PdfInteractionMode.selection,
  27. PdfScrollDirection scrollDirection = PdfScrollDirection.vertical,
  28. PdfPageLayoutMode pageLayoutMode = PdfPageLayoutMode.continuous,
  29. Color currentSearchTextHighlightColor = const Color.fromARGB(80, 249, 125, 0),
  30. Color otherSearchTextHighlightColor = const Color.fromARGB(50, 255, 255, 1),
  31. String? password,
  32. bool canShowPasswordDialog = true,
  33. bool canShowHyperlinkDialog = true,
  34. bool enableHyperlinkNavigation = 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.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.enableDocumentLinkAnnotation = true,
  this.canShowPaginationDialog = true,
  this.canShowSignaturePadDialog = true,
  this.initialScrollOffset = Offset.zero,
  this.initialZoomLevel = 1,
  this.maxZoomLevel = 3,
  this.interactionMode = PdfInteractionMode.selection,
  this.scrollDirection = PdfScrollDirection.vertical,
  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,
})  : _provider = NetworkPdf(src, headers),
      assert(pageSpacing >= 0),
      super(key: key);