Rotate paragraphs or cells some arbitrary number of degrees — Itext

后端 未结 2 651
感情败类
感情败类 2021-01-04 12:01

I have a web site where the users upload photos and create photobooks. Also, they can add text at absolute positions, rotations, and alignments. The text can have new lines.

2条回答
  •  旧巷少年郎
    2021-01-04 12:29

    • Create a PdfTemplate object; just a rectangle.
    • Draw your ColumnText on this PdfTemplate; don't worry about the rotation, just fill the rectangle with whatever content you want to add to the column.
    • Wrap the PdfTemplate inside an Image object; this is just for convenience, to avoid the math. This doesn't mean your text will be rasterized.
    • Now apply a rotation and an absolute position to the Image and add it to your document.

    Your problem is now solved ;-)

    PS: I'm the author of the iText in Action books.

提交回复
热议问题