Pdf Viewer Plugin

A Flutter plugin for IOS and Android providing a simple way to display PDFs.


Display PDF.


First, add pdf_viewer_plugin as a dependency in your pubspec.yaml file.


Add one row to the ios/Runner/info.plist:



You need to


Here is an example flutter app.

import 'dart:async';
import 'dart:io';
import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:pdf_viewer_plugin/pdf_viewer_plugin.dart';
import 'package:path_provider/path_provider.dart';
import 'package:http/http.dart' as http;

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

class MyApp extends StatefulWidget {
  _MyAppState createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  String path;

  initState() {

  Future<String> get _localPath async {
    final directory = await getApplicationDocumentsDirectory();

    return directory.path;

  Future<File> get _localFile async {
    final path = await _localPath;
    return File('$path/teste.pdf');

  Future<File> writeCounter(Uint8List stream) async {
    final file = await _localFile;

    // Write the file
    return file.writeAsBytes(stream);

  Future<Uint8List> fetchPost() async {
    final response = await http.get(
    final responseJson = response.bodyBytes;

    return responseJson;

  loadPdf() async {
    writeCounter(await fetchPost());
    path = (await _localFile).path;

    if (!mounted) return;

    setState(() {});

  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text('Plugin example app'),
        body: Center(
          child: Column(
            children: <Widget>[
              if (path != null)
                  height: 300.0,
                  child: PdfViewer(
                    filePath: path,
                Text("Pdf is not Loaded"),
                child: Text("Load pdf"),
                onPressed: loadPdf,

Get This Source Code on GitHub: