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)
Paul Rayman Posted: Wednesday, January 22, 2020 4:45:34 PM(UTC)
 
Try to use PdfViewer.PageToClient() or, if PdfViewer is not used in your App, then PdfPage.PageToDevice().
stan Posted: Tuesday, January 21, 2020 9:07:50 AM(UTC)
 
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)
stan Posted: Tuesday, January 21, 2020 6:30:20 AM(UTC)
 
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?