logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Paul Rayman  
#1 Posted : Wednesday, May 11, 2016 3:51:20 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Question:
I have a question. Is it possible to open the pdf file in the pdfviewer and select the coorinates by mouse click and extract the images only from the selected coordinates?

will the dll allow us to achieve this functionality..

thanks

Answer:
Yes, it is possible.
Please look at this example:
Code:

private void pdfViewer1_MouseClick(object sender, MouseEventArgs e)
{
	var page = pdfViewer1.Document.Pages.CurrentPage;
	var index = pdfViewer1.Document.Pages.CurrentIndex;

	foreach (var obj in page.PageObjects)
	{
		if (!(obj is PdfImageObject))
			continue;

		var boundingBox = obj.BoundingBox;
		var mousePoint = pdfViewer1.ClientToPage(index, e.Location);
		if (boundingBox.Contains(new Point((int)mousePoint.X, (int)mousePoint.Y)))
		{
			(obj as PdfImageObject).Bitmap.Image.Save(...);
		}
	}
}

mukesh  
#2 Posted : Monday, July 25, 2016 11:11:29 PM(UTC)
mukesh

Rank: Member

Groups: Registered
Joined: 7/14/2016(UTC)
Posts: 20
United States

Thanks: 4 times
Hello Paul,

Seems like your method has MouseClick event for pdfViewer object. But I can't find that event for pdfViewer on WPF app. What other event should I be using?
Paul Rayman  
#3 Posted : Tuesday, July 26, 2016 2:02:01 AM(UTC)
Paul Rayman

Rank: Administration

Groups: Administrators
Joined: 1/5/2016(UTC)
Posts: 1,138

Thanks: 10 times
Was thanked: 133 time(s) in 130 post(s)
Hi,
In a WPF App you can use MouseButtonEventArgs.GetPosition(...)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.