Rotate text to any degree in JasperReports

I am using iReport to create pdf. I need to rotate the text anyway. When I read in the documentation, iReport can rotate the text 90, 180, 270 and 360 degrees. I also want it to be dynamic.
For this, I try this procedure, but do not get the expected result.

rotate image using custom jar

His Java method works fine when I try to save an image and see its preview. But when I make a jar file and include it in iReport, I could not get any result.

I am trying to use CSS style of two types.

First, I create a text box, labeling it as html. Use inline css to rotate text. But its not working anymore. An example is here.

<title> <band height="313" splitType="Stretch"> <image> <reportElement uuid="c4edca6a-50d8-481f-bea0-9513268d4a88" x="13" y="13" width="150" height="41"/> <imageExpression><![CDATA[$P{REPORT_SCRIPTLET}.rotateText( $V{SpecialDescription},new java.awt.Font("Sans Serif",1,100), 100, 100, 45, java.awt.Color.white)]]></imageExpression> </image> <textField isStretchWithOverflow="true"> <reportElement uuid="22594755-7eba-4313-a1fd-41ac20dc50b5" x="141" y="101" width="234" height="53"/><textElement markup="html"/> <textFieldExpression><![CDATA["<html><div style=\"-moz- transform:rotate(20deg)translateX(230px)scale(1.5); -o-transform: rotate(20deg) translateX(230px) scale(1.5);-webkit-transform: rotate(20deg)translateX(230px)scale(1.5);transform: rotate(50deg) translateX(230px) scale(1.5);\">Hello</div><html>"]]></textFieldExpression> </textField> </band> </title> 

I am also trying to add css using the html component. To do this, I add htmlComponent.jar and write code to create it, but it also does not work.

One more thing, when I try to add a background color, it gives me the expected color, but it does not rotate the text.

Is there any other way to rotate the text?

+4
source share
1 answer

You can rotate the text to any extent using itext. You can use iText to read the pdf file created using jasper reports. Or read pdf as byteArray if it is not already written to the pdf file, then use itext PdfReader to read the contents

I hope that the following link will help you, which is designed for a watermark, but can be used to rotate content to a certain extent.

fooobar.com/questions/487600 / ...

0
source

Source: https://habr.com/ru/post/1498323/


All Articles