Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

flutter_pdfview

native pdf view for ios and android

use this package as a library

1. depend on it

add this to your package’s pubspec.yaml file:

dependencies:
  flutter_pdfview: ^1.0.4

2. install it

you can install packages from the command line:

with flutter:

$ flutter packages get

alternatively, your editor might support pub get or flutter packages get. check the docs for your editor to learn more.

3. setup

ios

opt-in to the embedded views preview by adding a boolean property to the app’s info.plist file
with the key io.flutter.embedded_views_preview and the value yes.

# info.plist
...
<key>io.flutter.embedded_views_preview</key>
<true/>
...

4. import it

now in your dart code, you can use:

import 'package:flutter_pdfview/flutter_pdfview.dart';

options

name android ios default
defaultpage 0
onviewcreated null
onrender null
onpagechanged null
onerror null
onpageerror null
onlinkhandle null
gesturerecognizers null
filepath
pdfdata
fitpolicy fitpolicy.width
enableswipe true
swipehorizontal false
password null
nightmode false
password null
autospacing true
pagefling true
pagesnap true
preventlinknavigation false

controller options

name description parameters return
getpagecount get total page count future<int>
getcurrentpage get current page future<int>
setpage go to/set page int page future<bool>

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');
  },
),

for production usage

if you use proguard, you should include this line.

-keep class com.shockwave.**

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.