flutter_pdfview
flutter_pdfview copied to clipboard
Is there a way to get the coordinates of a tap event on a page?
I would like to let the user add markers on the PDF. For that, I would need 2 things:
- Being able to listen to tap events on the PDF to get a set of coordinates X and Y
- Give the viewer a list of coordinates and some colors so that it can place the markers on top of the document
I understand that it may not be supported at the moment but may I have some indications on how to start if I had to implement this? Thanks a lot!
Have you tried to spread out GestureDetector in Stack with PDF like this:
Stack(
children: [
GestureDetector(
onLongPressStart: (touchDetails) {
double x = touchDetails.globalPosition.dx; // touchDetails.localPosition
// do something with coordinates
},
),
PDF(),
],
),`
Yes, the problem is when you zoom and pan, you don't get the right coordinates...
I've tried to pass ScaleGestureRecognizer
and PanGestureRecognizer
as gestureRecognizers
but they don't seem to catch any gesture.
I've asked a question on SO as this is not entirely related to the viewer itself but more to AndroidView and UiKitView
@GP4cK I know it's been two years, but did you have any luck with this? I'm in a similar situation right now, and am considering disabling zoom via some overlay, and having controls for page scrolling be done via buttons.
@sammusaev I ended up converting the PDF to png in the backend and use an InteractiveViewer.