Issue with text rotation

148 views
Skip to first unread message

arunsrinivaasrs

unread,
Jan 20, 2015, 8:13:15 AM1/20/15
to pdfne...@googlegroups.com

I have issues with text when the page is rotated. Exported as Landscape pdf.

Below is the code that i apply for other elements like Line, Rect and it works fine. 
currPageRotation  = page.GetRotation();
pdftron::Common::Matrix2D rotMtx(currPageRotation * DEG2RAD); //Note that i have a rotation angle of 270

For elements i multiply page rotation matrix with ctm,
pdftron::Common::Matrix2D ctm = path.GetCTM();
ctm *= pdftron::Common::Matrix2D::RotationMatrix( currPageRotation * DEG2RAD ); 

After multiplying all points with ctm,  i see that the rotation is fine and i see the elements in right place. 

But when i apply the rotation matrix to text it does not rotate properly. Below is the code.

               pdftron::Common::Matrix2D text_mtx = element.GetTextMatrix();
               text_mtx *= rotMtx;                
               pdftron::Common::Matrix2D ctm = element.GetCTM();
               ctm *= rotMtx;
               pdftron::Common::Matrix2D mtx = ctm * text_mtx;

I then multiply the resultant mtx with the character positioning information.

                       for (pdftron::PDF::CharIterator itr = element.GetCharIterator(); itr.HasNext(); itr.Next()) 
                       {
                             char_code = itr.Current().char_code;
                            charBuffer += string(1,char_code);
                            insertionPointX = itr.Current().x;
                            insertionPointY = itr.Current().y;
                            mtx.Mult(insertionPointX, insertionPointY);
                       }


Aaron

unread,
Jan 21, 2015, 5:26:16 PM1/21/15
to pdfne...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages