native_pdf_view 2.0.0-dev.1 copy "native_pdf_view: ^2.0.0-dev.1" to clipboard
native_pdf_view: ^2.0.0-dev.1 copied to clipboard

outdated

Flutter plugin to render PDF files on both Android and iOS devices. Provides a Widget to render the pages using a PageView.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:native_pdf_view/native_pdf_view.dart';
import 'package:native_pdf_view_example/has_support.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  Future<PDFDocument> _getDocument() async {
    if (await hasSupport()) {
      return PDFDocument.openAsset('assets/sample.pdf');
    } else {
      throw Exception(
        'PDF Rendering does not '
        'support on the system of this version',
      );
    }
  }

  @override
  Widget build(BuildContext context) => MaterialApp(
        theme: ThemeData(primaryColor: Colors.white),
        home: Scaffold(
          appBar: AppBar(title: Text('PDFView example')),
          body: FutureBuilder<PDFDocument>(
            future: _getDocument(),
            builder: (_, snapshot) {
              if (snapshot.hasData) {
                return PDFView(
                  document: snapshot.data,
                );
              }

              if (snapshot.hasError) {
                return Center(
                  child: Text(
                    'PDF Rendering does not '
                    'support on the system of this version',
                  ),
                );
              }

              return Center(child: CircularProgressIndicator());
            },
          ),
        ),
      );
}
398
likes
0
pub points
94%
popularity

Publisher

verified publisherserge.software

Flutter plugin to render PDF files on both Android and iOS devices. Provides a Widget to render the pages using a PageView.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

extended_image, flutter, meta, native_pdf_renderer

More

Packages that depend on native_pdf_view