Hi Carlos,
I just did this and found the info in the list archives. You just have to
apply a transform which is pretty trivial. It sounds like your problem is
that you're using ColumnText.showTextAligned() which "Shows a line of text.
Only the first line is written."
Try something like this instead. In this example, textBox is my own object
where the x and y coordinates specify the upper left corner of my box:
final ColumnText ct = new ColumnText(cb);
ct.setSimpleColumn(textBox.getX(), textBox.getY() - textBox.getHeight(),
textBox.getX() + textBox.getWidth(), textBox.getY());
ct.addElement(someElement); // add some text that you've defined already
with addElement or addText
// Before applying a transform, save the current state
cb.saveState();
// Rotate around the center of the TextBox by setting the center of the
textBox as the rotation anchor point
AffineTransform af = new AffineTransform();
af.rotate(textBox.getRotationDegrees() * Math.PI / 180.0, textBox.getX() +
textBox.getWidth() / 2, textBox.getY() - textBox.getHeight() / 2);
cb.transform(af);
ct.go();
cb.restoreState();
Hope that helps,
Jon
On Thu, Mar 14, 2013 at 9:46 AM, Carlos Arturo Bernal Carvajal <
bernalcarva...@gmail.com> wrote:
>
> Hello,
>
> I need to add text to a PDF file at absolute positions, rotations, and
> alignments. The text can have multiple lines.
>
> In theory what i would need to do, is to define a paragraph of some
> defined width and height, set the users text, font, font style,
> alignment(center, left, right, justify), and finally set the rotation.
>
> For what i've read about Itext, i could create a paragraph set the user
> properties, and use a ColumnText Object to set the absolute position, width
> and height. However it's not possibly to set the rotation of anything
> bigger than single line.
>
> I cant use table cells either, because the rotation method only allow
> degrees that are multiples of 90.
>
> Is there a add a paragraph with some rotation (say 20 degrees) without
> having to add the text line by line using the ColumnText.showTextAligned()
> method and all math that involves?
>
> Thank you for your help.
>
> --
> Carlos Bernal
>
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_mar
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php