Reputation: 4094
I have a pdfptable with some pdfpcells and this sheet is printed off and brought around with each part. When the part is on the rack, the sheets are upside down. How can I write some text into a pdfpcell and then rotate it 180 degrees?
Upvotes: 1
Views: 689
Reputation: 1896
pdfpcells details here: http://api.itextpdf.com/itext/com/itextpdf/text/Image.html
[Edit] Ignore below method, use setRotation as Dah discovered below. Thanks for the upvote Dah, I didnt deserve it :)
You will have to create an image, draw your text to the image, translate the image to -y, or rotate the image.
Then write the image to url, and then pass that image url into the constructor for an 'com.itextpdf.text.Image'.
For drawing text in an image: Java - Draw text in the center of an image
g2d.translate(0, 2 * imageHeight + gap);
g2d.scale(1, -1);
OR
Rotate the image: Java: Rotating Images
Then:
Write an image to a file: http://docs.oracle.com/javase/tutorial/2d/images/saveimage.html
Upvotes: 1