1

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?

davidahines
  • 3,976
  • 16
  • 53
  • 87

2 Answers2

1

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

Draw the image upside down:

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

Community
  • 1
  • 1
Damienknight
  • 1,876
  • 2
  • 18
  • 34
0

Apprently I missed the Oh-so-obvious PdfPCell.setRotation();

davidahines
  • 3,976
  • 16
  • 53
  • 87