alh_pdf_view는 바이트 데이터 또는 파일 경로를 사용하여 PDF 파일을 위젯으로 표시할 수 있는 Flutter 패키지입니다. 확대, 스크롤 및 페이지 탐색과 같은 추가 기능을 제공하여 상호작용 가능한 PDF 렌더링이 필요한 앱에 적합합니다. 이 패키지는 Android와 iOS 플랫폼을 모두 지원하여 크로스플랫폼 호환성을 보장합니다. Flutter의 위젯 시스템과 원활하게 통합되며 모바일 앱 내 문서 보기 용도로 이상적입니다.
사용 사례
파일 경로에서 PDF 표시
바이트 데이터에서 PDF 렌더링
확대 기능이 있는 인터랙티브 PDF 탐색
모바일 앱에 문서 삽입하기
사용자가 업로드한 PDF 보기
문서 미리보기 화면 만들기
주요 기능
바이트 또는 파일 경로에서 PDF 렌더링을 지원합니다
내장형 줌 및 스크롤 기능
크로스 플랫폼(안드로이드 및 iOS)
Flutter 위젯과의 간편한 통합
가볍고 빠른 렌더링
페이지 탐색 컨트롤
적합한 대상
문서 뷰어 앱
전자학습 플랫폼
모바일 뱅킹 앱
PDF 주석 도구
콘텐츠 관리 시스템
사용자 생성 콘텐츠 미리보기
고려 사항
올바른 파일 경로 처리가 필요합니다
기본 PDF 상호작용에 제한됨
내장된 텍스트 선택 또는 검색 없음
외부 네이티브 라이브러리에 의존합니다
큰 PDF 파일에서는 성능 문제가 발생할 수 있습니다
복잡한 PDF 편집에 적합하지 않습니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
With this widget, you can display a PDF with bytes or a path.
This is a list of all parameters that can be used for this widget. Consider that some paremters only work for one platform.
Parameter
Description
Default Value
filePath
Optional path to load PDF file.
-
bytes
Optional bytes to load PDF file.
-
fitPolicy
Defines how the PDF should fit inside the widget.
FitPolicy.both
fitEachPage
Each page of the PDF will fit inside the given space. (only Android)
true
enableSwipe
The current page will be changed when swiping.
true
swipeHorizontal
If true, all pages are displayed in horizontal direction.
false
nightMode
Inverting colors of pages to have the look of a dark mode. (only Android)
false
autoSpacing
If true, spacing will be added to fit each page on its own on the screen. (only Android)
true
pageFling
Making a fling change.
true
pageSnap
Snap pages to screen boundaries when changing the current page. (only Android)
true
defaultPage
Describes which page should be shown at first.
0
defaultZoomFactor
Defines how much the displayed PDF page should zoomed when rendered.
1.0
backgroundColor
Setting backgroundColor of remaining space around the pdf view.
Colors.transparent
password
Unlocks PDF page with this password.
""
enableDoubleTap
When double tapping, the zoom of the page changes. (only Android)
1.0
minZoom
Min zoom value that the user can reach while zooming.
0.5
maxZoom
Max zoom value that the user can reach while zooming.
4.0
enableDefaultScrollHandle
Adds a button to scroll faster through the document. (only Android)
false
showScrollbar
If true, a Scrollbar is visible for the Pdf View (only iOS).
true
spacing
Spacing between pdf pages.
0
This is a list of functional parameters.
Parameter
Description
Default Value
gestureRecognizers
Which gestures should be consumed by the pdf view.
-
onViewCreated
If not null invoked once the native view is created.
-
onRender
Callback once the PDF page was loaded.
-
onPageChanged
When changing the page, this method will be called with the new page.
-
onZoomChanged
Called when changing the zoom.
-
onError
When there are errors happening, this methods returns a message.
-
onLinkHandle
Called when tapping a link in PDF. (only iOS)
-
AlhPdfViewController
If you want to start specific actions for the displayed PDF file, you can use AlhPdfViewController.
This controller contains some functionalities to update your view. Here is a list of them.
Parameter
Description
getPageSize
Returns the size of the given [page] index. (only iOS)
getPageCount
Returns the number of pages for the PDF.
getCurrentPage
Returns the current displayed page.
goToNextPage
Navigates to the next page of the PDF.
goToPreviousPage
Navigates to the previous page of the PDF.
setPage
Jumping to the page optionally animated.
resetZoom
Setting the scale factor to the default zoom factor.