|
|
for anyone who's interested in doing the same, I finally use the below to make the switch. Code:
public static class BoundingBoxConverter
{
public static Rectangle ToDevBox(this PdfPageObject pageObj, PdfPage page)
{
var pt1 = page.PageToDevice(0, 0, Convert.ToInt32(page.Width), Convert.ToInt32(page.Height), PageRotate.Normal, pageObj.BoundingBox.Left, pageObj.BoundingBox.Top);
var pt2 = page.PageToDevice(0, 0, Convert.ToInt32(page.Width), Convert.ToInt32(page.Height), PageRotate.Normal, pageObj.BoundingBox.Right, pageObj.BoundingBox.Bottom);
//Build rectangle
var rect = new Rectangle(pt1.X, pt1.Y, pt2.X - pt1.X, pt2.Y - pt1.Y);
//And normalize it if it has the negative size in any dimension
if (rect.Width < 0)
{
rect.Width = -rect.Width;
rect.X -= rect.Width;
}
if (rect.Height < 0)
{
rect.Height = -rect.Height;
rect.Y -= rect.Height;
}
return rect;
}
}
|
|
|
Hi!
In pdf the coordinate count is from the lower left corner of the page.
Therefore, you can not switch the countdown, as you want.
|
|
|
I found that the bounding boxes of all objects use lower left as origin, however, I would like to use upper left as origin. How can I make this switch without converting the origin everytime I uses it?
|
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