Matthias Flury wrote: > What ist the "right way" to draw a rectangle > rotated at specified angle
It depends. (1) When drawing graphics on a rectangle, I usually create a PdfTemplate, draw whatever shapes I need on this small canvas, then wrap the PdfTemplate in an Image, scale, rotate, translate the image, and add it to the document. (2) When drawing graphics directly to a page, I am usually to lazy to do the algebra needed to calculate the CTM, and I use affine transformations (because there are some standard transformations available in the Standard Java API). > (we need it to put a blank bar below a > stamped text)? How are you stamping the text on the PDF? (3) Are you filling an AcroField? In that case, I find it easier to change the background color of the AcroField than to draw the rectangle myself. (4) How are you adding the stamped text? If you are using ColumnText, it might be easier to set the background color of the Chunk. (4') If the content has to be rotated, a PdfPTable with one cell drawn at an absolute position would also be an elegant solution. (5) If you are using showTextAligned to add the text. It's not sufficient to simply rotate everything around the lower left corner of the page. (Who knows where the rectangle is drawn?) You have to do the math, and take into account that Adobe algebra is slightly different than the algebra we learned at school. I can only refer to the PDF Reference in this case. > Finaly we end up to draw lines and afterwards we fill the > shape. Is this "the right way" ? I have added numbers to my answers to show that there are 5 different ways to do what you are asking. I don't know your project, so there's no way I can tell you what is the best choice for you. br, Bruno ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
