Rank: Member
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 15
|
I am using pdfium to handle converting a pdf to a designer.cs file for winforms.
Conversion of pdfium points to winform pixels. The direct conversion seems to work only for left and right coordinates and not the top / bottom coordinates.
Example:
I have a control who's points are L:270.96, B:684.24, R: 383.16, T:699.6 in pdfium
Converting the Right and Left points using 1.3 (96/72)
L to px => 270.96 pt * 1.3 px/pt = 352.25px R to px => 383.16 pt * 1.3 px/pt = 498.11px
This conversion equal(given +/- 3 px) the correct L and R values.
When converting Top and Bottom from pt to px Top to px => 699.6 pt * 1.3 px/pt = 909.48 px Bottom to px => 684.24 * 1.3 px/pt = 889.51 px
The values I expect for Top is 122 and Bottom are 142. My assumption is pdfium uses a different quadrant system then what winforms uses. I believe winform uses the top left as the origin with values increasing as the move away from the origin.
*------- | | | |
Is there a way to convert the top and bottom coordinates from pdfium into winform coordinates?
|
|
|
|
|
|
Rank: Member
Groups: Registered
Joined: 2/21/2019(UTC) Posts: 15
|
I believe I figured this out. To calculate the difference for top and bottom in pdfium to winforms you need to use (page height * 1.33) - (control top * 1.33)
|
|
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,138
Thanks: 10 times Was thanked: 133 time(s) in 130 post(s)
|
Try to use PdfViewer.PageToClient() or, if PdfViewer is not used in your App, then PdfPage.PageToDevice().
|
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can 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