Battle Beef
Battle Beef

Reputation: 3

iTextSharp angle of text

I have a little problem with my application. I want to add a text to a PDF but with a little special thing. The text has to be italic, but the angle of italic is too high! Italic has a angle of 11 degrees but I need 10 degrees!

I don't know how itextsharp works, if there is a function which creates a new italic function which is another like Visual Studio uses. Then I could edit the library, but I don't know how.

Or is there a possibility to create my own function which does what I want?

I don't need a rotation I need a angle like italic.

Thanks for you help.

Upvotes: 0

Views: 265

Answers (1)

Joris Schellekens
Joris Schellekens

Reputation: 9057

There is a method you can call on Chunk that does this for you.

Chunk chunk = new Chunk("Hello world",  
                        FontFactory.getFont(FontFactory.COURIER, 
                                            20, 
                                            Font.NORMAL, 
                                            new BaseColor(255, 0, 0)));  
chunk.setSkew(0, 25);
document.add(chunk);

The method setSkew does all the magic here.

For more details, check out http://developers.itextpdf.com/examples/itext-action-second-edition/chapter-3

It also shows examples of using this method.

Upvotes: 1

Related Questions