Orientação gerada a partir de informações públicas. Apenas para referência.
alh_pdf_view é um pacote Flutter que permite exibir arquivos PDF como widgets usando dados em bytes ou caminhos de arquivos. Ele oferece recursos adicionais, como zoom, rolagem e navegação entre páginas, tornando-o adequado para aplicativos que exigem renderização interativa de PDFs. O pacote suporta tanto plataformas Android quanto iOS, garantindo compatibilidade entre plataformas. Integra-se perfeitamente ao sistema de widgets do Flutter e é ideal para visualização de documentos em aplicativos móveis.
Casos de uso
Exibindo PDFs a partir de caminhos de arquivos
Renderização de PDFs a partir de dados em bytes
Navegação interativa em PDF com zoom
Incorporar documentos em aplicativos móveis
Visualização de PDFs carregados pelo usuário
Criando telas de visualização de documentos
Principais recursos
Suporta renderização de PDF a partir de bytes ou caminhos de arquivos
Funcionalidade de zoom e rolagem embutidas
Multiplataforma (Android e iOS)
Integração fácil com widgets do Flutter
Renderização leve e rápida
Controles de navegação de página
Indicado para
Aplicativos de visualização de documentos
Plataformas de e-learning
Aplicativos de banco móvel
Ferramentas de anotação PDF
Sistemas de gerenciamento de conteúdo
Pré-visualizações de conteúdo gerado pelo usuário
Considerações
Requer manipulação adequada do caminho do arquivo
Limitado às interações básicas com PDF
Sem seleção de texto ou pesquisa embutidas
Depende de bibliotecas nativas externas
Pode ter problemas de desempenho com PDFs grandes
Não adequado para edição complexa de PDF
README original
Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.
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.