- Home
- Forum
- Xamarin.Forms
- Drag & Drop Custom Stamp
Drag & Drop Custom Stamp
Hi. I want to be able to drag a custom stamp (image) from my toolbar and drop it on an arbitrary location on the Pdf?Viewer. During the drop event, how can I find the page number and location on that page in the PdfViewer?
Regards,
Arthur
SIGN IN To post a reply.
4 Replies
1 reply marked as answer
AV
Ashokkumar Viswanathan
Syncfusion Team
November 16, 2020 08:30 AM UTC
Hi Arthur,
Greetings from Syncfusion support,
Your requirement of getting the exact page number and position of the custom stamp added can be achieved using the StampAnnotationAdded event handler. The StampAnnotationAddedEventArgs properties of the added custom stamp annotation includes page number and bounds information.
Please refer the below code snippet,
|
pdfViewerControl.StampAnnotationAdded += PdfViewerControl_StampAnnotationAdded;
private void PdfViewerControl_StampAnnotationAdded(object sender, StampAnnotationAddedEventArgs e)
{
//Gets the page number of added stamp annotation
int pageNumber = e.PageNumber;
//Gets the bounds of added stamp annotation
Rectangle bounds = e.Bounds;
} |
Please find the UG documentation in the below link,
If our understanding is different from your requirement, kindly explain your requirement and the use case scenario elaborately. So that it will helpful for us to analyze the issue and provide a better solution at earliest.
Please let us know whether the provided solution resolved your query.
Best & Regards,
Ashok Kumar Viswanathan.
Ashok Kumar Viswanathan.
AB
Arthur Butler
November 16, 2020 11:09 AM UTC
Thank you for the quick response. I want to know how to convert the coordinates from a Drop event on the PdfViewer to a page number and coordinate so that I can call the pdfViewer.AddStamp(View view, int pageNumber, Point position) function to put a stamp at the dropped location.
Regards,
Arthur
AV
Ashokkumar Viswanathan
Syncfusion Team
November 17, 2020 03:07 PM UTC
Hi Arthur,
Thank you for your update,
We will analyze the possibility of adding stamp annotation using drop event and we will update further details on November 20th 2020.
Regards
Ashok Kumar Viswanathan.
AV
Ashokkumar Viswanathan
Syncfusion Team
November 20, 2020 05:47 PM UTC
Hi Arthur,
While analyzing the possibility of adding stamp annotation using drag and drop, we could not find any solution to get the X and Y co-ordinates where the image is dropped. However, as alternate solution we can suggest you with PdfViewer control’s Tapped event, where you could get the proper co-ordinate points and page number to add stamp instead of using drag and drop approach.
Please refer the below code snippet,
|
pdfViewerControl.Tapped += PdfViewerControl_Tapped;
private void PdfViewerControl_Tapped(object sender, TouchInteractionEventArgs e)
{
//Gets the page number of tapped page
int pageNumber = e.PageNumber;
//Gets the tapped co-ordinates
Point tappedPoint = e.Position;
pdfViewerControl.AddStamp(image, pageNumber, tappedPoint);
} |
Also please refer the below blog to add custom stamp,
Please let us know whether, the above suggested approach is okay for you. Meanwhile, we will analyze the possibility of obtaining the drop location by implementing the finger/pointer move, finger/pointer released events instead of using the Drop event as it does not provide the location.
Regards,
Ashok Kumar Viswanathan.
Marked as answer
SIGN IN To post a reply.
- 4 Replies
- 2 Participants
- Marked answer
-
AB Arthur Butler
- Nov 15, 2020 07:21 AM UTC
- Nov 20, 2020 05:47 PM UTC