Element.GetBBox() and rotated pages

135 views
Skip to first unread message

Support

unread,
Apr 7, 2014, 8:59:18 PM4/7/14
to pdfne...@googlegroups.com
Q:

I have pages with a rotation of 90 but the coordinates of the GetBBox() function on a line or word object are not rotated.
 
The documentation of the GetBBox() function says:
     The bounding box already accounts for the effects of current transformation matrix (CTM), text matrix, font size,
      and other properties in the graphics state.
 
Anything special I need to do to get the correct x, y, x2, y2 ? 

-------
A:

GetBBox() does not include the effect of Rotate and CropBox attributes in page dictionary.
To apply the effect of page rotation and crop box transform GetBBox() rect with GetDefaultMatrix().

 

For more info see:

   https://groups.google.com/d/msg/pdfnet-sdk/4sPgTwkaAoE/shXolsUDUs0J

   https://groups.google.com/forum/#!searchin/pdfnet-sdk/GetDefaultMatrix%7Csort:relevance%7Cspell:false

 

For example:

 

Rect bbox = …

Matrix2D mtx = page.GetDefaultMatrix();

mtx.Mult(ref bbox.x1, ref bbox.x1);

mtx.Mult(ref bbox.x2, ref bbox.x2);

 


 



 
 
Reply all
Reply to author
Forward
0 new messages