FLUTTER ECOSYSTEM

CrossPT/flutter_plugin_pdf_viewer

PDF 파일을 처리하기 위한 플러터 플러그인입니다. Android 및 iOS에서 모두 작동합니다

flutter_plugin_pdf_viewer 프로젝트 이미지
Stars
94
Forks
373
최근 푸시(UTC)
2022. 8. 1.
프로젝트 상태
활성
Tiago Ribeiro GitHub avatar
GITHUB User

Tiago Ribeiro ↗

Currently working at StreamlinePortugal공식 웹사이트 ↗
언어DartObjective-CJavaRuby

기술 주제

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 6 개

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

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.