CPDFReaderWidgetController constructor

CPDFReaderWidgetController(
  1. int id, {
  2. CPDFPageChangedCallback? onPageChanged,
  3. CPDFDocumentSaveCallback? saveCallback,
})

Implementation

CPDFReaderWidgetController(int id, {
  CPDFPageChangedCallback? onPageChanged,
  CPDFDocumentSaveCallback? saveCallback}) {
  _channel = MethodChannel('com.compdfkit.flutter.ui.pdfviewer.$id');
  _channel.setMethodCallHandler((call) async {
    switch (call.method) {
      case 'onPageChanged':
        var pageIndex = call.arguments['pageIndex'];
        onPageChanged?.call(pageIndex);
        break;
      case 'saveDocument':
        saveCallback?.call();
        break;
    }
  });
  _document = CPDFDocument.withController(id);
}