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

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
nobody Posted: Friday, July 10, 2020 4:45:54 AM(UTC)
 
Works like a charm, thanks a lot again!
Paul Rayman Posted: Thursday, July 9, 2020 5:05:26 AM(UTC)
 
Call ClientToPage before scaling to find out the coordinates of your point in the page coordinate space.
After scaling, call PageToclient to find out the new coordinates of your point in the coordinate space of the control.
Now you can draw this point in any WPF-specific way. And this point will be in the same place as before relative to the page elements.

The coordinates of the point in the page coordinate space are the same regardless of the scale or rotation of the page.
nobody Posted: Thursday, July 9, 2020 4:13:54 AM(UTC)
 
Quote:
PdfViewer.OnRender

Don't exactly know how to use this, but it won't be necessary I guess as I don't wanna draw the rectangle on the page directly. I would prefer to use like another layer and that's why I've been trying to use a canvas or grid instead, but thanks anyway. Maybe I'll try later on...

Quote:
Try ClientToPage / PageToClient to translate point between the coordinate space of the page and the control.

In this case if I use PageToClient method, it seems to be the same as CalcActualRect meaning, that I can get these values from the CalcActualRect. I haven't got a lot of experience with such a computing so I might be wrong or just don't know how to use it properly.
Could you lead me more please?

Thanks!
Paul Rayman Posted: Tuesday, July 7, 2020 5:43:26 AM(UTC)
 
Originally Posted by: nobody Go to Quoted Post
I've been trying to figure out how to add a custom shape (like a zone, which purpose is highliting the selected place) on the pdf page in WPF.
It's easy to do it in WinForms using PdfViewer.OnPaint method, but there is nothing like that in WPF if I'm right and please correct me if not.


PdfViewer.OnRender

Quote:

Is there any way how to bound the shape's size to the page (its content)?


Try ClientToPage / PageToClient to translate point between the coordinate space of the page and the control.
nobody Posted: Monday, July 6, 2020 2:52:18 AM(UTC)
 
Hi there,

I've been trying to figure out how to add a custom shape (like a zone, which purpose is highliting the selected place) on the pdf page in WPF.
It's easy to do it in WinForms using PdfViewer.OnPaint method, but there is nothing like that in WPF if I'm right and please correct me if not.

Therefore I've tried a numerous ways and did it by adding a shape in a grid or canvas which is fine, but the problem occured when started zooming the page.
I used the methods such as PdfViewer.CalcActualRect etc. to get the coords of the page rect, then a difference between the shape rect and page rect and so on, but it still doesn't scale properly when zooming the page or resizing a window.

Is there any way how to bound the shape's size to the page (its content)?
Or can you explain me a bit how it works please?
I would really appreciate it!

Thanks