PdfPreview class

Flutter widget that uses the rasterized pdf pages to display a document.

Inheritance

Constructors

PdfPreview({Key? key, required LayoutCallback build, PdfPageFormat? initialPageFormat, bool allowPrinting = true, bool allowSharing = true, double? maxPageWidth, bool canChangePageFormat = true, bool canChangeOrientation = true, bool canDebug = true, List<Widget>? actions, Map<String, PdfPageFormat> pageFormats = _defaultPageFormats, Widget onError(BuildContext context, Object error)?, void onPrinted(BuildContext context)?, void onPrintError(BuildContext context, dynamic error)?, void onShared(BuildContext context)?, Decoration? scrollViewDecoration, Decoration? pdfPreviewPageDecoration, String? pdfFileName, bool useActions = true, List<int>? pages, bool dynamicLayout = true, String? shareActionExtraBody, String? shareActionExtraSubject, List<String>? shareActionExtraEmails, EdgeInsets? previewPageMargin, EdgeInsets? padding, bool shouldRepaint = false, Widget? loadingWidget, ValueChanged<PdfPageFormat>? onPageFormatChanged, double? dpi, PdfActionBarTheme actionBarTheme = const PdfActionBarTheme(), bool enableScrollToPage = false, ValueChanged<bool>? onZoomChanged})
Show a pdf document built on demand
const
PdfPreview.builder({Key? key, required LayoutCallback build, PdfPageFormat? initialPageFormat, bool allowPrinting = true, bool allowSharing = true, double? maxPageWidth, bool canChangePageFormat = true, bool canChangeOrientation = true, bool canDebug = true, List<Widget>? actions, Map<String, PdfPageFormat> pageFormats = _defaultPageFormats, Widget onError(BuildContext context, Object error)?, void onPrinted(BuildContext context)?, void onPrintError(BuildContext context, dynamic error)?, void onShared(BuildContext context)?, Decoration? scrollViewDecoration, Decoration? pdfPreviewPageDecoration, String? pdfFileName, bool useActions = true, List<int>? pages, bool dynamicLayout = true, String? shareActionExtraBody, String? shareActionExtraSubject, List<String>? shareActionExtraEmails, EdgeInsets? previewPageMargin, EdgeInsets? padding, bool shouldRepaint = false, Widget? loadingWidget, ValueChanged<PdfPageFormat>? onPageFormatChanged, double? dpi, PdfActionBarTheme actionBarTheme = const PdfActionBarTheme(), required CustomPdfPagesBuilder pagesBuilder, bool enableScrollToPage = false, ValueChanged<bool>? onZoomChanged})
Build a custom layout.
const

Properties

actionBarTheme → PdfActionBarTheme
The style of actions bar.
final
actions → List<Widget>?
Additional actions to add to the widget
final
allowPrinting → bool
Add a button to print the pdf document
final
allowSharing → bool
Add a button to share the pdf document
final
build → LayoutCallback
Called when a pdf document is needed
final
canChangeOrientation → bool
Add a switch to change the page orientation
final
canChangePageFormat → bool
Add a drop-down menu to choose the page format
final
canDebug → bool
Add a switch to show debug view
final
dpi → double?
The rendering dots per inch resolution If not provided, this value is calculated.
final
dynamicLayout → bool
Request page re-layout to match the printer paper and margins. Mitigate an issue with iOS and macOS print dialog that prevent any channel message while opened.
final
enableScrollToPage → bool
Whether scroll to page functionality enabled.
final
hashCode → int
The hash code for this object.
no setterinherited
initialPageFormat → PdfPageFormat?
Pdf page format asked for the first display
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
loadingWidget → Widget?
Custom loading widget to use that is shown while PDF is being generated. If null, a CircularProgressIndicator is used instead.
final
maxPageWidth → double?
Maximum width of the pdf document on screen
final
onError → Widget Function(BuildContext context, Object error)?
Widget to display if the PDF document cannot be displayed
final
onPageFormatChanged → ValueChanged<PdfPageFormat>?
The page format has changed
final
onPrinted → void Function(BuildContext context)?
Called if the user prints the pdf document
final
onPrintError → void Function(BuildContext context, dynamic error)?
Called if an error creating the Pdf occurred
final
onShared → void Function(BuildContext context)?
Called if the user shares the pdf document
final
onZoomChanged → ValueChanged<bool>?
The zoom mode has changed
final
padding → EdgeInsets?
padding for the pdf_preview widget
final
pageFormats → Map<String, PdfPageFormat>
List of page formats the user can choose
final
pages → List<int>?
Pages to display. Default will display all the pages.
final
pdfFileName → String?
Name of the PDF when sharing. It must include the extension.
final
pdfPreviewPageDecoration → Decoration?
Decoration of PdfPreviewPage
final
previewPageMargin → EdgeInsets?
margin for the document preview page
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollViewDecoration → Decoration?
Decoration of scrollView
final
shareActionExtraBody → String?
extra text to share with Pdf document
final
shareActionExtraEmails → List<String>?
list of email addresses which will be filled automatically if the email application is selected from the share dialog. This will work only for Android platform.
final
shareActionExtraSubject → String?
email subject when email application is selected from the share dialog
final
shouldRepaint → bool
Force repainting the PDF document
final
useActions → bool
Allow disable actions
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → PdfPreviewState
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited