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)
gsdeng Posted: Saturday, December 2, 2017 1:03:06 AM(UTC)
 
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;
        }
    }
PataAndrey Posted: Friday, December 1, 2017 8:13:07 PM(UTC)
 
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.
gsdeng Posted: Friday, December 1, 2017 8:30:24 AM(UTC)
 
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?