The Syncfusion PDF Viewer is part of the Essential Study for Flutter from Syncfusion as a commercially licensed package.
In this blog post I’m going to implement a PDF Viewer to compare with the Syncfusion commercial version. Below is using flutter_pdfview
which can be added from Pub or using VSCode shortcuts, now for the demo.
Using the package as a library in Flutter
dependencies:
flutter_pdfview: ^1.2.1
$ flutter packages get
// dart file
import 'package:flutter_pdfview/flutter_pdfview.dart';
// dart file example
PDFView(
filePath: path,
enableSwipe: true,
swipeHorizontal: true,
autoSpacing: false,
pageFling: false,
onRender: (_pages) {
setState(() {
pages = _pages;
isReady = true;
});
},
onError: (error) {
print(error.toString());
},
onPageError: (page, error) {
print('$page: ${error.toString()}');
},
onViewCreated: (PDFViewController pdfViewController) {
_controller.complete(pdfViewController);
},
onPageChanged: (int page, int total) {
print('page change: $page/$total');
},
),
Note: this is a feature to be implemented in Kier Connect.