Replies: 5 comments 2 replies
-
I see your point. They seems very convenient when implementing typical PDF viewer. |
Beta Was this translation helpful? Give feedback.
-
daa6d7d implements panTo method: /// Pan to the specified page point.
///
/// [x],[y] should be in [0 1] range and they indicate relative position in the page:
/// - 0 for top/left
/// - 1 for bottom/right
/// - 0.5 for center (the default)
///
/// [anchor] specifies which view corner, edge, or center the point specified by ([x],[y]) is anchored to.
///
/// [zoomRatio] specifies the zoom ratio. The default is to use the zoom ratio that fit the page into the view.
/// If you want to keep the current zoom ratio, use [PdfViewerController.zoomRatio] for the value.
///
/// If the page does not exist in the layout, it returns null.
/// If the controller is not ready([isReady]), the method throws an exception.
Future<void> panTo({
required int pageNumber,
double? padding,
double x = 0.5,
double y = 0.5,
PdfViewerAnchor anchor = PdfViewerAnchor.center,
double? zoomRatio,
Duration duration = const Duration(milliseconds: 500),
) |
Beta Was this translation helpful? Give feedback.
-
final controller = PdfViewerController();
TapDownDetails? doubleTapDetails;
...
GestureDetector(
// Supporting double-tap gesture on the viewer.
onDoubleTapDown: (details) => doubleTapDetails = details,
onDoubleTap: () => controller.ready?.setZoomRatio(
zoomRatio: controller.zoomRatio * 1.5,
center: doubleTapDetails!.localPosition,
),
child: PdfViewer.openAsset(
'assets/hello.pdf',
viewerController: controller,
... |
Beta Was this translation helpful? Give feedback.
-
1.0.22 that contains the changes is released! |
Beta Was this translation helpful? Give feedback.
-
Because of the consistency/compatibility to the existing codes/interfaces, the naming is changed from your first suggestion, I think the designs of the new methods covers what you want to do. Anyway, please test them and feel free to suggest/comment anything here! |
Beta Was this translation helpful? Give feedback.
-
Hi,
first of all thanks for this library @espresso3389, it's really saving us for a work related project right now due to its flexiblity and features.
As I was trying to integrate this plugin into my App, I was kind of lost on how to programmatically scale into the PDF with the
PdfViewerController
(I wanted to implement a double tap zoom in /out functionality).I digged into the plugin code and realized that you have the control about everything by using the
PdfViewerController.goTo
method. and passing a suitedMatrix4
value. So my question is whether it would be possible to have methods that abstract the usage of thisMatrix4
. I think this would benefit many developers as in my opinion it requires some additional knowledge hurdle.So my proposal would be some additional methods for
PdfViewerController
, e.g.:I dont' have the best understand about the usage of
Matrix4
yet, so I'm not sure whether it's even possible to have such methods, but I would like to hear some opinions on that.In the meantime I will try to implement the above mentioned methods.
Beta Was this translation helpful? Give feedback.
All reactions