The Flutter PDF Viewer widget lets you view PDF documents seamlessly and efficiently in Android, iOS, web, and macOS platforms. It has highly interactive and customizable features such as magnification, virtual scrolling, page navigation, and bookmark navigation.
The Flutter PDF Viewer widget was updated in the 2021 Volume 3 release with:
Horizontal scrolling
The PDF Viewer supports the following scrolling options:
- Vertical scrolling
- Horizontal scrolling
By default, vertical scrolling is enabled, which scrolls the PDF pages from top to bottom. The new horizontal scrolling support allows you to scroll PDF pages from left to right.
The following code example explains how to configure the PDF Viewer widget to horizontal scrolling mode.
@override Widget build(BuildContext context) { return Scaffold( body: Container( child: SfPdfViewer.network( 'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf', scrollDirection: PdfScrollDirection.horizontal))); }
Page-by-page view (single-page layout mode)
Now, the PDF Viewer supports the following page layout modes:
- Continuous-page layout mode
- Single-page layout mode
The continuous-page layout mode is enabled by default. It allows us to continuously scroll the PDF pages vertically and horizontally.
The new single-page layout lets you display a PDF in page-by-page order horizontally.
The following code example explains how to configure the PDF Viewer widget to single-page layout mode.
@override Widget build(BuildContext context) { return Scaffold( body: Container( child: SfPdfViewer.network( 'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf', pageLayoutMode: PdfPageLayoutMode.single))); }
Accessibility
With the 2021 Volume 3 release, you can enjoy screen-reader accessibility support in the Flutter PDF Viewer. The PDF Viewer can be accessed by screen readers by wrapping the widget into the Semantics widget.
Refer to the following code.
@override Widget build(BuildContext context) { return Scaffold( body: Semantics( label: 'Syncfusion Flutter PDF Viewer', child: SfPdfViewer.network( 'https://cdn.syncfusion.com/content/PDFViewer/flutter-succinctly.pdf'), ), ); }
Conclusion
Thanks for reading! I hope you enjoyed this blog about the new features of the Flutter PDF Viewer available in the 2021 Volume 3 release. Info on these features is also available in our Release Notes and What’s New pages. Try out these new, user-friendly updates and leave your feedback in the comments section below!
Explore the Flutter PDF Viewer user guide to see all the available features in it. Check out our Flutter examples in this GitHub repository. In addition, you can download our Flutter demo app from Google Play and the App Store.
If you are an existing Syncfusion user, please download the latest version of Essential Studio® from the License & Downloads page and try the new features for yourself. If you aren’t a customer yet, you can try our 30-day free trial to check out these features.
You can contact us through our support forum, Direct-Trac, or feedback portal. We are always happy to assist you!