搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.7

flutter_plugin_pdf_viewer

一個用於處理 PDF 檔案的 Flutter 插件。可在 Android 與 iOS 上運行

近 30 天下載
125
喜歡數
63
Pub 分數
40

安裝套件

flutter pub add flutter_plugin_pdf_viewer

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一個專為行動應用程式設計的 Flutter 插件,用於在 Android 與 iOS 平台上顯示和處理 PDF 檔案。它提供簡單的介面,可直接在應用程式 UI 中呈現 PDF,讓使用者無需離開應用程式即可檢視文件。此插件輕巧且與 Flutter 的 widget 系統完全整合,非常適合需要文件檢視功能的應用。

適用情境

  • 顯示使用者產生的PDF
  • 在應用程式內檢視文件
  • 顯示發票或收據
  • 閱讀電子教科書
  • 渲染掃描的文件

主要特色

  • 跨平台支援(Android 與 iOS)
  • 與 Flutter 小部件的簡單整合
  • 高效的PDF渲染
  • 支援縮放和滾動
  • 輕巧且快速

適合對象

  • 需要PDF顯示的移動應用
  • 教育類或電商應用
  • 文件管理工具
  • 內部業務應用
  • 包含數位內容的應用程式

使用建議

  • 不支援 PDF 編輯
  • 僅限檢視
  • 無內建搜尋功能
  • 某些設備需要外部檔案存取權限
  • 效能可能會因大型 PDF 而異

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_plugin_pdf_viewer

A flutter plugin for handling PDF files. Works on both Android & iOS

Installation

Add flutter_plugin_pdf_viewer as a dependency in your pubspec.yaml file.

flutter_plugin_pdf_viewer: any

Android

No permissions required. Uses application cache directory.

iOS

No permissions required.

How-to:

Load PDF
// Load from assets
PDFDocument doc = await PDFDocument.fromAsset('assets/test.pdf');
 
// Load from URL
PDFDocument doc = await PDFDocument.fromURL('http://www.africau.edu/images/default/sample.pdf');

// Load from file
File file  = File('...');
PDFDocument doc = await PDFDocument.fromFile(file);
Load pages
// Load specific page
PDFPage pageOne = await doc.get(page: _number);
Pre-built viewer

Use the pre-built PDF Viewer

@override
  Widget build(BuildContext context) {
    Scaffold(
        appBar: AppBar(
          title: Text('Example'),
        ),
        body: Center(
        child: _isLoading
            ? Center(child: CircularProgressIndicator())
            : PDFViewer(document: document)),
    );
  }

This code produces the following view:

Demo Screenshot 1

TODO

  • Allow password-protected files
  • Refactor PDFDocument.getAll() method
  • Increase page resolution
  • Add swipe to change page

Third-party packages used
Name Description
path_provider A Flutter plugin for finding commonly used locations on the filesystem. Supports iOS and Android.
flutter_cache_manager A CacheManager to download and cache files in the cache directory of the app. Various settings on how long to keep a file can be changed.
numberpicker NumberPicker is a custom widget designed for choosing an integer or decimal number by scrolling spinners.
flutter_advanced_networkimage An advanced image provider provides caching and retrying for flutter app. Now with zoomable widget and transition to image widget.

所屬分類

依賴

依賴清單 5 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。