native_pdf_renderer2 1.8.2

Flutter Android iOS

Flutter plugin to render PDF pages as images on both Android and iOS devices.

PDF Renderer #

Flutter Plugin to render PDF pages as images on both Android 5.0+ and iOS 11.0+ devices.

For IOS need set swift version to 5 (instruction, issue)

Getting Started #

In your flutter project add the dependency:

pub package

dependencies:
  native_pdf_renderer2: any

For help getting started with Flutter, view the online documentation.

Usage example #

Read more

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:native_pdf_renderer2/native_pdf_renderer2.dart';

void main() async {
  try {
    final document = await PDFDocument.openAsset('assets/sample.pdf');
    final page = await document.getPage(1);
    final pageImage = await page.render(width: page.width, height: page.height);
    await page.close();
    runApp(
      MaterialApp(
        home: Scaffold(
          body: Center(
            child: Image(
              image: MemoryImage(pageImage.bytes),
            ),
          ),
        ),
        color: Colors.white,
      )
    );
  } on PlatformException catch (error) {
    print(error);
  }
}

Rendering PDF files on Android devices #

This plugin uses the Android native PdfRenderer to render the pages of PDF files and provides a widget called PdfRenderer to display the PDF page you like.

Rendering PDF files on IOS devices #

This plugin uses the IOS native PDFKit to render the pages of PDF files and provides a widget called PDFKit to display the PDF page you like.

1
likes
80
pub points
23%
popularity

Flutter plugin to render PDF pages as images on both Android and iOS devices.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

blazejzet@gmail.com

License

MIT (LICENSE)

Dependencies

extension, flutter, meta, synchronized

More

Packages that depend on native_pdf_renderer2