pdfviewr and position mouse
Is there a component in pdfviewr that allows adding an image at a position selected by the mouse?
If I can recover the position X, Y, Z it would be enough.
SIGN IN To post a reply.
3 Replies
VS
Vikas Sekar
Syncfusion Team
July 31, 2020 08:08 PM UTC
Hi Matthew,
Thanks for contacting Syncfusion support.
In PdfViewerControl by using PageClicked event we can get the current clicked position and page index of the PDF page. Please find the code snippet below to use the PageClicked event.
|
#region Constructor
public Form1()
{
InitializeComponent();
//Load the PDF file.
pdfViewerControl1.Load("../../Data/HTTP Succinctly.pdf");
//Wire the `PageClicked` event.
pdfViewerControl1.PageClicked += PdfViewer_PageClicked;
}
#endregion
#region Event
void PdfViewer_PageClicked(object sender, PageClickedEventArgs args)
{
//Find the page number in which the mouse clicks occurred.
int currentPage = args.PageIndex;
//Find the mouse position on above the document page
System.Drawing.PointF mousePosition = args.Position;
}
#endregion |
Refer to the UG Link: https://help.syncfusion.com/windowsforms/pdf-viewer/how-to/get-mouse-position#page-clicked-event
Currently, we are analyzing to add an image at a given position in PDFpages. We will update you with further details on 4th Aug, 2020.
Regards,
Vikas
Hi Matthew,Thanks for contacting Syncfusion support.In PdfViewerControl by using PageClicked event we can get the current clicked position and page index of the PDF page. Please find the code snippet below to use the PageClicked event.
#region Constructorpublic Form1(){InitializeComponent();//Load the PDF file.pdfViewerControl1.Load("../../Data/HTTP Succinctly.pdf");//Wire the `PageClicked` event.pdfViewerControl1.PageClicked += PdfViewer_PageClicked;}#endregion#region Eventvoid PdfViewer_PageClicked(object sender, PageClickedEventArgs args){//Find the page number in which the mouse clicks occurred.int currentPage = args.PageIndex;//Find the mouse position on above the document pageSystem.Drawing.PointF mousePosition = args.Position;}#endregionRefer to the UG Link: https://help.syncfusion.com/windowsforms/pdf-viewer/how-to/get-mouse-position#page-clicked-eventCurrently, we are analyzing to add an image at a given position in PDFpages. We will update you with further details on 4th Aug, 2020.Regards,Vikas
Hello again,
thank you very much for the information above, I'm trying to get by with it.
Looking in the forum I saw that you have something similar to what I imagined in
https://www.syncfusion.com/blogs/post/draw-on-a-pdf-in-a-windows-app.aspx
but I couldn't replicate in windows forms, is there any example?
Attachment: DrawonPDF_550_5d0b95f0.rar
DG
Deepak Gunasekaran
Syncfusion Team
August 3, 2020 12:33 PM UTC
Hi Matthew,
We do not have support for drawing free form (ink) annotation in Windows Forms as supported in the Windows Apps that you have shown us as a reference. However, this support was already provided in the WPF PDF Viewer and that can be hosted in WinForms application to achieve the requirement, please refer to the following links for more details.
Host PDFviewer WPF in windows forms application: https://www.syncfusion.com/kb/8972/how-to-host-pdfviewer-wpf-in-windows-forms-application
WPF free form (ink) annotation UG: https://help.syncfusion.com/wpf/pdf-viewer/working-with-annotations/ink-annotation
We have also modified the sample by setting the ink annotation mode as default and it can be downloaded from the following location:
Kindly let us know if the above suggestion helps and let us know if you need any further assistance.
Regards,
Deepak G
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
RO Rogério
- Jul 30, 2020 04:14 PM UTC
- Aug 3, 2020 12:33 PM UTC