PdfViewerController class

Controls associated PdfViewer.

It's always your option to extend (inherit) the class to customize the PdfViewer behavior.

Please note that almost all fields and functions are not working if the controller is not associated to any PdfViewer. You can check whether the controller is associated or not by checking isReady property.

Inheritance

Constructors

PdfViewerController.new()

Properties

alternativeFitScale double?
The zoom ratio that fits whole the page to the view port.
no setter
centerPosition Offset
no setter
coverScale double
The zoom ratio that fits the page's smaller side (either horizontal or vertical) to the view port.
no setter
currentZoom double
no setter
doc2local DocumentCoordinateConverter
Converts document coordinates to local coordinates.
no setter
document PdfDocument
Get the associated document.
no setter
documentRef PdfDocumentRef
The document reference associated to the PdfViewer.
no setter
documentSize Size
The document layout size.
no setter
focusNode FocusNode?
FocusNode associated to the PdfViewer if available.
no setter
hashCode int
The hash code for this object.
no setterinherited
isReady bool
Determine whether the document/pages are ready or not.
no setter
layout PdfPageLayout
Page layout.
no setter
minScale double
The minimum zoom ratio allowed.
no setter
pageCount int
Get the page count of the document.
no setter
pageNumber int?
The current page number if available.
no setter
pages List<PdfPage>
Get the associated pages.
no setter
params PdfViewerParams
Get the associated PdfViewerParams parameters.
no setter
renderBox RenderBox?
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
textSelectionDelegate PdfTextSelectionDelegate
The text selection delegate.
no setter
value Matrix4
The current value of the object. When the value changes, the callbacks registered with addListener will be invoked.
getter/setter pairoverride-getter
viewSize Size
The view port size (The widget's client area's size)
no setter
visibleRect Rect
The area of the document layout which is visible on the view port.
no setter
widget PdfViewer
Get the associated PdfViewer widget.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object notifies its listeners.
override
calcFitZoomMatrices({bool sortInSuitableOrder = true}) List<PdfPageFitInfo>
Get list of possible matrices that fit some of the pages into the view.
calcMatrixFitHeightForPage({required int pageNumber}) Matrix4?
Calculate the matrix to fit the specified page height into the view.
calcMatrixFitWidthForPage({required int pageNumber}) Matrix4?
Calculate the matrix to fit the specified page width into the view.
calcMatrixFor(Offset position, {double? zoom, Size? viewSize}) Matrix4
Calculate the matrix to center the specified position.
calcMatrixForArea({required Rect rect, PdfPageAnchor? anchor}) Matrix4
Calculate the matrix for the specified area.
calcMatrixForDest(PdfDest? dest) Matrix4?
Calculate the matrix for the specified destination.
calcMatrixForFit({required int pageNumber}) Matrix4?
Calculate the matrix to fit the page into the view.
calcMatrixForPage({required int pageNumber, PdfPageAnchor? anchor}) Matrix4
Calculate the matrix for the page.
calcMatrixForRect(Rect rect, {double? zoomMax, double? margin}) Matrix4
calcMatrixForRectInsidePage({required int pageNumber, required PdfRect rect, PdfPageAnchor? anchor}) Matrix4
Calculate the matrix for the specified area inside the page.
calcMatrixToEnsureRectVisible(Rect rect, {double margin = 0}) Matrix4
calcRectForRectInsidePage({required int pageNumber, required PdfRect rect}) Rect
Calculate the rectangle for the specified area inside the page.
documentToGlobal(Offset document) Offset?
Converts the local position in the PDF document structure to the global position.
ensureVisible(Rect rect, {Duration duration = const Duration(milliseconds: 200), double margin = 0}) Future<void>
Ensure the specified area is visible inside the view port.
forceRepaintAllPageImages() → void
Force redraw all the page images.
getNextZoom({bool loop = true}) double
getPdfPageHitTestResult(Offset offset, {required bool useDocumentLayoutCoordinates}) PdfPageHitTestResult?
Do hit-test against laid out pages.
getPreviousZoom({bool loop = true}) double
globalToDocument(Offset global) Offset?
Converts the global position to the local position in the PDF document structure.
globalToLocal(Offset global) Offset?
Converts the global position to the local position in the widget.
goTo(Matrix4? destination, {Duration duration = const Duration(milliseconds: 200)}) Future<void>
Go to the specified position by the matrix.
goToArea({required Rect rect, PdfPageAnchor? anchor, Duration duration = const Duration(milliseconds: 200)}) Future<void>
Go to the specified area.
goToDest(PdfDest? dest, {Duration duration = const Duration(milliseconds: 200)}) Future<bool>
Go to the specified destination.
goToPage({required int pageNumber, PdfPageAnchor? anchor, Duration duration = const Duration(milliseconds: 200)}) Future<void>
Go to the specified page.
goToRectInsidePage({required int pageNumber, required PdfRect rect, PdfPageAnchor? anchor, Duration duration = const Duration(milliseconds: 200)}) Future<void>
Go to the specified area inside the page.
handlePointerSignalEvent(PointerSignalEvent event) → void
Provided to workaround certain widgets eating wheel events. Use with Listener.onPointerSignal.
invalidate() → void
Invalidates the current Widget display state.
localToGlobal(Offset local) Offset?
Converts the local position to the global position in the widget.
makeMatrixInSafeRange(Matrix4 newValue, {bool forceClamp = false}) Matrix4
Restrict matrix to the safe range.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyFirstChange(void onFirstChange()) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that the object notifies.
override
requestFocus() → void
Request focus to the PdfViewer.
setCurrentPageNumber(int pageNumber) → void
Set the current page number.
setZoom(Offset position, double zoom, {Duration duration = const Duration(milliseconds: 200)}) Future<void>
toString() String
A string representation of this object.
inherited
useDocument<T>(FutureOr<T> task(PdfDocument document), {bool ensureLoaded = true, Completer? cancelLoading}) FutureOr<T?>
Within call to the function, it ensures that the PdfDocument is alive (not null and not disposed).
zoomDown({bool loop = false, Offset? zoomCenter, Duration duration = const Duration(milliseconds: 200)}) Future<void>
zoomUp({bool loop = false, Offset? zoomCenter, Duration duration = const Duration(milliseconds: 200)}) Future<void>

Operators

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