simple_pdf_viewer

A very simple native pdf viewer.


Keywords
flutter, pdf, pdf-viewer
License
Apache-2.0

Documentation

simple_pdf_viewer

A very simple flutter plugin project. Just show pdf from remote url on android/ios, support embedded widget.

Features

On Android, first it use okhttp to download file to cache folder, then use built on AndroidPdfViewer to load file on local.

On IOS, it just use embedded webview to load url.

Note

Add this to ios/Runner/info.plist to support embedded widget

<key>io.flutter.embedded_views_preview</key>
<true/>

If your pdf url is http not https, add this to

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key>
    <true/>
</dict>

Add follow to android/app/build.gradle

 release {
            ndk {
                abiFilters "armeabi-v7a", "x86"
            }
        }

If you have some android compile error about android support-v4 or AndroidX. It may caused by android webview plugin, we could remove the plugin to fix.

  1. add this config to android/app/build.gradle top level
configurations{
    all*.exclude module: "webview_flutter"
}
  1. create dir io.flutter.plugins.webviewflutter, create file WebViewFlutterPlugin.java with follow content
package io.flutter.plugins.webviewflutter;

import io.flutter.plugin.common.PluginRegistry;

public class WebViewFlutterPlugin {
    public static void registerWith(PluginRegistry.Registrar registrar) {
        //Do nothing
    }
}

Install

simple_pdf_viewer: ^0.2.1

License: Apache 2.0

Thanks

Screenshot

image