Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
Is it possible to extract image under mouse pointer?
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(...);
}
}
}
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 7/14/2016(UTC) Posts: 20  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?
|
|
|
|
|
|
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(...)
|
|
|
|
|
|
Patagames Software Support Forum
»
Pdfium.Net SDK
»
FAQ
»
Is it possible to extract image under mouse pointer?
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.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close