views:

40

answers:

2

i need text rotation option in pdf creation, is it somehow possible? does any such api exists?

+2  A: 

iText. It's Open Source and you can even buy a quite good book on it written by the author. (And yes, of course it supports rotated text.)

danbystrom
thanks, thats great, can you please tell me how to do rotation of text and image from itext? thanks in advace
shabby
Free text: setTextMatrix(), TextField: setRotation(), Images: setRotation() (or setRotationDegrees())
danbystrom
danbystorm, plz can you give me a working example of text rotation, i'd be really thankful, i figured out image rotation which is quite simple but cant find out the text rotation, thanks
shabby
+2  A: 

Assuming that you are going to use the library iTextSharp, as suggested in another answer (iText is a Java library; iTextSharp is a .NET port of it), here's some examples. These are essentially stripped-down versions from Bruno Lowagie's book iText in Action from Manning Publications.

(Note that the examples are written in Java, since I took them straight from the book, but you should be able to easily adapt them to the iTextSharp library and C#.)

Image rotation:

This is found in the book on page 155.

Image img = Image.getInstance("foo.jpg");
img.setRotationDegrees(45);

Text rotation:

This is found in the book on page 351-352.

PdfContentByte cb = ...;
cb.showTextAligned(PdfContentByte.ALIGN_LEFT, "Some text", e, f, angle);

where e and f are translation values (the coordinates, essentially), and angle is the rotation angle.

stakx