- 전체
- 게임 일반 (make game basics)
- 모바일 기획 및 디자인
- GameMaker Studio
- Unity3D
- Cocos2D
- 3D Engine OGRE
- 3D Engine irrlicht
- copperCube
- corona SDK
- Windows Basic Game
- BaaS (Mobile Backend)
- phnegap & cordova
- ionic & anguler
- parse (backend)
- firebase (backend)
- Game Backend Server / Opt
- web assembly
- Smart Makers
- pyGame & Ren'Py
- 머드(MUD) 게임 만들기
- Xamarin(자마린)
- flutter (플루터 앱 개발)
- construct 2 / 3
- pocketbase
- RPG Maker 시리즈
- godot engine
- playmaker(unity)
- react native
flutter (플루터 앱 개발) [flutter (플루터 앱 개발)] Flutter PDF 뷰어를 만드는 방법 : How to build a Flutter PDF viewer
2025.01.19 19:03
[flutter (플루터 앱 개발)] Flutter PDF 뷰어를 만드는 방법 : How to build a Flutter PDF viewer

본 기사는 2022년 3월에 처음 게시되었으며 2024년 9월에 업데이트되었습니다.
Flutter 는 Google에서 개발한 오픈 소스 프레임워크로, Dart의 단일 코드베이스에서 모바일, 웹 및 데스크톱용 네이티브 컴파일 애플리케이션을 만들 수 있습니다. 이 게시물에서는 Flutter에서 단일 페이지 문서를 처리하기 위한 기본 PDF 뷰어를 설정하는 과정을 안내합니다.
다양한 오픈 소스 옵션에서 PDF 보기에 적합한 패키지를 선택하는 방법을 알아보는 것으로 시작합니다. 그런 다음 선택한 패키지를 Flutter 프로젝트에 통합하여 기능적인 PDF 뷰어 앱을 만듭니다.
Flutter에 적합한 PDF 패키지 선택
Flutter용 PDF 라이브러리를 선택할 때는 요구 사항을 평가하고 패키지 품질 및 기능과 같은 요소를 고려하는 것이 필수적입니다. 간단한 사용 사례의 경우 오픈 소스 라이브러리를 탐색하는 것이 좋은 시작점입니다. 보다 고급 요구 사항의 경우 Nutrient는 포괄적인 기능을 갖춘 강력한 Flutter PDF SDK를 제공합니다 .
적합한 패키지를 찾으려면 pub.dev 에서 검색하면pdf 수많은 옵션이 나타납니다. 고려해야 할 주요 요소는 다음과 같습니다.
-
Pub 포인트 - null 안전성 지원 및 Dart 규칙 준수를 포함하여 정적 분석을 기반으로 한 패키지의 품질을 반영합니다.
-
인기 - 패키지를 사용하는 개발자의 수를 나타냅니다.
-
업데이트 빈도 - 최근 업데이트 날짜는 종종 활발하게 유지 관리되는 프로젝트를 의미합니다.
-
검증된 게시자 - 일부 패키지는 검증된 게시자로부터 제공되므로 신뢰도가 더욱 높아집니다.
검색 결과 중에서 주목할 만한 패키지는 다음과 같습니다.
-
flutter_pdfviewPDFView— Android와 iOS에서 위젯을 제공하는 Flutter 플러그인입니다 . -
native_pdf_view— 웹, macOS, Windows, Android, iOS에서 PDF 파일을 렌더링하기 위한 Flutter 플러그인입니다. -
advance_pdf_viewer— PDF 파일을 처리하기 위한 Flutter 플러그인입니다.
세 패키지를 빠르게 평가한 결과, flutter_pdfview간단한 PDF 뷰어를 구현하는 실험의 목표에 가장 적합한 것으로 판명되었습니다. GitHub 저장소 에 예제가 포함되어 있으며, 구성 단계는 따르기 쉽고, 후드 아래에는 PDFium 이라는 Google 라이브러리가 기반을 두고 있습니다. Nutrient 에서는 PDFium을 좋아합니다 ! ❤️
flutter_pdfview로 PDF 뷰어 구축
flutter_pdfviewAndroid와 iOS 플랫폼에서 PDF를 렌더링할 수 있는 Flutter 패키지입니다. Flutter 앱 내에서 PDF 파일을 표시하는 매끄러운 방법을 제공하며, 페이지 탐색, 확대/축소 등의 기능을 제공합니다. 사용자 지정 환경을 제공하기 위한 몇 가지 구성 옵션을 노출하며 , GitHub 저장소 에 예제 앱 이 포함되어 있습니다 .
사용 사례를 간단하게 유지하기 위해, 이 게시물에서는 API 30flutter_pdfview 이 있는 Android 기기에서 단일 페이지 PDF 문서를 표시하는 데 사용합니다 .
이 앱의 기본 레이아웃은 렌더링된 PDF 문서를 보여주는 위젯이며, 핀치 투 줌, 확대된 페이지 드래그와 같은 간단한 제스처가 가능합니다.
시작하기
시작하려면 개발 머신에 Flutter가 설치되고 설정되어 있는지 확인하세요. 다음 명령을 실행하여 확인할 수 있습니다.
이 명령은 Flutter로 개발을 시작하는 데 필요한 모든 것이 준비되었는지 확인합니다.
1단계 - 새로운 Flutter 프로젝트 생성
새로운 Flutter 프로젝트를 만드는 것으로 시작합니다. 터미널을 열고 다음을 실행합니다.
프로젝트 디렉토리로 이동합니다.
2단계 - flutter_pdfview 종속성 추가
다음으로, 종속성 아래 파일 flutter_pdfview에 패키지를 추가합니다 pubspec.yaml.
![]()
공백은 YAML 파일에서 중요하므로 위의 내용에 주의하세요.
flutter pub get패키지를 설치하려면 실행하세요 .
3단계 - Android 및 iOS 구성 업데이트
Android의 경우 minSdkVersion최소 21 이상 이어야 합니다 android/app/build.gradle.
iOS의 경우 다음을 추가하여 Swift 지원을 활성화하세요 ios/Podfile.
4단계 - PDF 뷰어 위젯 만들기
이제 PDF 뷰어 위젯을 만듭니다. lib/main.dart해당 내용을 열고 다음 코드로 바꿉니다.
5단계 - 샘플 PDF 추가
폴더 에 이름이 지정된 샘플 PDF 문서를 추가합니다 . 폴더가 없으면 프로젝트의 루트 디렉토리에 만듭니다. 그런 다음 파일을 업데이트하여 자산을 포함합니다.sample.pdfassetspubspec.yaml
6단계 - 앱 실행
PDF 뷰어를 실행하려면 실제 Android 기기를 연결하거나 Android Virtual Device Manager 에서 에뮬레이터를 열어야 합니다 . 그런 다음 명령줄에서 다음을 입력합니다.
짧은 개발 과정을 거치면 PDF 뷰어 앱을 Android 기기에서 사용할 수 있습니다. ????
결론
이 블로그 게시물에서는 오픈 소스 패키지 세트에서 PDF 패키지를 선택할 때 고려해야 할 몇 가지 요소를 다루었고, flutter_pdfview너무 번거롭지 않고 간단한 사용 사례를 해결하는 데 좋은 오픈 소스 Flutter PDF 라이브러리를 사용하여 PDF 뷰어를 빌드하는 방법을 보여드렸습니다. 그러나 AndroidPdfViewer라이브러리 의 기반이 되는 는 몇 년 동안 업데이트를 받지 못했으며, 현재 읽기 전용인 아티팩트 저장소인 JCenterflutter_pdfview 에 여전히 게시되어 있습니다 .
더 복잡한 사용자 정의를 위해 Nutrient는 자세한 시작 가이드가 포함된 자체 Flutter PDF 라이브러리를 제공합니다 . Nutrient에는 다음을 포함한 많은 기본 기능이 제공됩니다.
-
간편하고 사용하기 쉬운 사용자 정의 UI .
-
문서에 주석을 달거나 PDF 양식 에 디지털 서명을 추가하는 등 의 기능을 쉽게 추가할 수 있는 내장형 사전 구축 도구입니다 .
-
다양한 파일 형식 지원 - 이미지 파일(JPG, PNG, TIFF)부터 PDF 문서까지.
또한 지속적인 개선 및 버그 수정을 통해 활발한 개발 주기를 제공합니다 . Nutrient Flutter SDK를 시작하려면 무료 평가판을 확인하세요 . Flutter PDF 라이브러리에 대한 질문이 있으면 언제든지 문의하세요 . 기꺼이 도와드리겠습니다!
자주 묻는 질문
Flutter PDF 뷰어를 만드는 데 관해 자주 묻는 몇 가지 질문은 다음과 같습니다.
Flutter에 적합한 PDF 패키지를 선택하려면 어떻게 해야 하나요?
PDF 패키지를 선택할 때는 퍼브 포인트, 인기, 업데이트 빈도, 패키지가 필요한 기능을 지원하는지 여부와 같은 요소를 고려하세요. Flutter의 인기 패키지에는flutter_pdfview, native_pdf_view, 및 가 있습니다 advance_p.
![]()
This article was first published in March 2022 and was updated in September 2024.
Flutter is an open source framework developed by Google that allows for creating natively compiled applications for mobile, web, and desktop from a single codebase in Dart. This post will walk through the process of setting up a basic PDF viewer in Flutter to handle single-page documents.
It’ll start by exploring how to choose the right package for PDF viewing from a range of open source options. Then, you’ll proceed to integrate the selected package into a Flutter project, resulting in a functional PDF viewer app.
Choosing the right PDF package for Flutter
When selecting a PDF library for Flutter, it’s essential to evaluate your requirements and consider factors like package quality and functionality. For simple use cases, exploring open source libraries is a great starting point. For more advanced needs, Nutrient offers a robust Flutter PDF SDK with comprehensive features.
To find suitable packages, searching for pdf on pub.dev reveals a plethora of options. Key factors to consider include:
-
Pub points — Reflects the quality of the package based on static analysis, including support for null safety and adherence to Dart conventions.
-
Popularity — Indicates the number of developers using the package.
-
Update frequency — A recent update date often signifies an actively maintained project.
-
Verified publisher — Some packages come from verified publishers, adding an extra layer of trust.
Among the search results, the following packages are noteworthy:
-
flutter_pdfview— A Flutter plugin that provides aPDFViewwidget on Android and iOS. -
native_pdf_view— A Flutter plugin for rendering PDF files on web, macOS, Windows, Android, and iOS. -
advance_pdf_viewer— A Flutter plugin for handling PDF files.
After a quick assessment of the three packages, flutter_pdfview proved to be the most suitable for the goal of the experiment of implementing a simple PDF viewer. It has an example included in the GitHub repository, the configuration steps are easy to follow, and under its hood, it’s based on a Google library called PDFium — and here at Nutrient, we love PDFium! ❤️
Building a PDF viewer with flutter_pdfview
flutter_pdfview is a Flutter package that allows you to render PDFs on both Android and iOS platforms. It provides a seamless way to display PDF files within your Flutter app, offering features such as page navigation, zooming, and more. It exposes some configuration options to provide a customized experience, and there’s an example app included in the GitHub repository.
To keep the use case simple, this post will use flutter_pdfview to show a single-page PDF document on an Android device with API 30.
The main layout of the app will be a widget showing the rendered PDF document, and it’ll allow simple gestures like pinch-to-zoom and dragging the zoomed page.
Getting started
To get started, ensure you have Flutter installed and set up on your development machine. You can check this by running the following command:
This command will verify if you have everything in place to start developing with Flutter.
Step 1 — Creating a new Flutter project
Begin by creating a new Flutter project. Open your terminal and run:
Navigate to your project directory:
Step 2 — Adding the flutter_pdfview dependency
Next, add the flutter_pdfview package to your pubspec.yaml file under dependencies:
![]()
Be careful with the above, as spaces matter in YAML files.
Run flutter pub get to install the package.
Step 3 — Updating the Android and iOS configurations
For Android, ensure your minSdkVersion is at least 21 in android/app/build.gradle:
For iOS, enable Swift support by adding the following to your ios/Podfile:
Step 4 — Creating the PDF viewer widget
Now you’ll create the PDF viewer widget. Open lib/main.dart and replace its content with the following code:
Step 5 — Adding a sample PDF
Add a sample PDF document named sample.pdf to your assets folder. If the folder doesn’t exist, create it in the root directory of your project. Then, update your pubspec.yaml file to include the assets:
Step 6 — Running the app
To run the PDF viewer, make sure to connect a physical Android device or open an emulator from the Android Virtual Device Manager. Then from the command line, type:
After a short building process, the PDF viewer app will be ready to use on the Android device. ????
Conclusion
In this blog post, we covered some factors to look at when selecting a PDF package from a set of open source packages, and we showed you how to build a PDF viewer using the open source Flutter PDF library, flutter_pdfview, which is good for solving simple use cases without too much hassle. However, AndroidPdfViewer — the library flutter_pdfview is based on — hasn’t received an update in a few years, and it’s still published to JCenter, an artifact repository that’s now read-only.
For more complex customizations, Nutrient offers its own Flutter PDF library with a detailed getting started guide. Nutrient ships with many features out of the box, including:
-
A customizable UI that’s simple and easy to use.
-
Embeddable prebuilt tools to easily add functionality like annotating documents, adding digital signatures to a PDF form, and much more.
-
Multiple file type support — from image files (JPG, PNG, TIFF) to PDF documents.
It also features active development cycles with constant improvements and bug fixes. To get started with Nutrient Flutter SDK, check out our free trial. If you have any questions about our Flutter PDF library, please don’t hesitate to reach out to us. We’re happy to help!
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 6 | [TextMode Game Create] Text based game | 졸리운_곰 | 2024.08.25 | 519 |
| 5 |
무작정 배우는 C언어 머드(MUD)게임 만들기 Part5 게임스랩
| 졸리운_곰 | 2020.10.17 | 724 |
| 4 |
무작정 배우는 C언어 머드(MUD)게임 만들기 Part4 게임스랩
| 졸리운_곰 | 2020.10.17 | 563 |
| 3 |
무작정 배우는 C언어 머드(MUD)게임 만들기 Part3 게임스랩
| 졸리운_곰 | 2020.10.17 | 1025 |
| 2 |
무작정 배우는 C언어 머드(MUD)게임 만들기 Part2 게임스랩
| 졸리운_곰 | 2020.10.17 | 1236 |
| 1 |
무작정 배우는 C언어 머드(MUD)게임만들기 Part1 게임스랩
| 졸리운_곰 | 2020.10.17 | 5646 |

