Re: CTM + re

"MacGregor, Duncan (GE Energy Management)" <[email protected]>
Newsgroups gmane.comp.java.lib.itext.general
Message-ID <D040A288.B4839%[email protected]>
Sorry, just replied to the wrong mail.

From: <MacGregor>, Duncan MacGregor <[email protected]<mailto:[email protected]>>
Date: Thursday, 18 September 2014 14:48
To: FDnC Red <[email protected]<mailto:[email protected]>>, Post all your questions about iText here <[email protected]<mailto:[email protected]>>
Subject: Re: [iText-questions] CTM + re

Yeah, found it. I’ll get right on it as soon as my machine has finished rebooting (my entire machine froze, so I think I beat your app crashes :-) ).

From: FDnC Red <[email protected]<mailto:[email protected]>>
Reply-To: FDnC Red <[email protected]<mailto:[email protected]>>, Post all your questions about iText here <[email protected]<mailto:[email protected]>>
Date: Thursday, 18 September 2014 14:35
To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Subject: [iText-questions] CTM + re

Two questions.  1) Am I transforming this rectangle by the matrix correctly?  2) Is there an easier way?

The Content Stream
q
1.1342565 0 0 1.199793 0 0 cm
41.906 201.086 0.936 -69.448 re
f
Q

float rectXPt = ((PdfNumber)operands[0]).FloatValue; //41.906
float rectYPt = ((PdfNumber)operands[1]).FloatValue; //201.086
float rectWidthPt = ((PdfNumber)operands[2]).FloatValue; //0.936
float rectHeightPt = ((PdfNumber)operands[3]).FloatValue; //-69.48

//Translate based on transformation matrix
//x1 = a * x + c * y + e
//y1 = b * x + d * y + f

//a = 1.1342565
//b = 0
//c = 0
//d = 1.199793
//e = 0
//f = 0

float transStartXPt = m[0] * rectXPt + m[3] * rectYPt + m[6];
float transStartYPt = m[1] * rectXPt + m[4] * rectYPt + m[7];
float tempEndXPt = rectXPt + rectAbsWidthPt;
float tempEndYPt = rectYPt + rectAbsHeightPt;
float transEndXPt = m[0] * tempEndXPt + m[3] * tempEndYPt + m[6];;
float transEndYPt = m[1] * tempEndXPt + m[4] * tempEndYPt + m[7];


Thanks,
Darren

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.