Coder Social home page Coder Social logo

liqwik / flutter_fullpdfview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arnaudelub/flutter_fullpdfview

0.0 0.0 0.0 3.82 MB

Flutter package available on pub.dev

Home Page: https://pub.dev/packages/flutter_fullpdfview

License: MIT License

Java 21.51% Ruby 7.89% Objective-C 29.60% Dart 40.99%

flutter_fullpdfview's Introduction

flutter_fullpdfview

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_fullpdfview: latest_version

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 pub 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.

4. Import it

Now in your Dart code, you can use:

import 'package:flutter_fullpdfview/flutter_fullpdfview.dart';

Options

Name Android iOS
onViewCreated V V
onRender V V
onPageChanged V V
onError V V
onPageError V X
gestureRecognizers V V
filePath V V
fitEachPage V V
defaultPage V V
dualPageMode V V
displayAsBook V V
dualPageWithBreak V V
enableSwipe V V
swipeHorizontal V V
password V V
nightMode V X
password V V
autoSpacing V V
pageFling V V
pageSnap V V
backgroundColor V V
fitPolicy V X

Only black and white are supported on Android and iOS at the moment!

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>
setPageWithAnimation Go to/Set page int page Future<bool>
resetZoom Go page and fitToWidth int page Future<bool>
getZoom Get the current zoom double zoom Future<double>
setZoom Set the current zoom double zoom Future<double>
getPageWidth Get the pdf width double width Future<double>
getPageHeight Get the pdf height double height Future<double>

Example

PDFView(
  filePath: path,
  enableSwipe: true,
  fitEachPage: true,
  swipeHorizontal: true,
  autoSpacing: false,
  pageFling: false,
  defaultPage: 8,
  dualPageMode: orientation == Orientation.landscape,
  displayAsBook: true,
  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.**

Dependencies

Android

apv Updated From: AndroidPdfViewer

iOS (only support> 11.0)

PDFKit

flutter_fullpdfview's People

Contributors

arnaudelub avatar ct-toch avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.