Jump to content
We've recently updated our Privacy Statement, available here ×

artduc

Members
  • Posts

    2
  • Joined

  • Last visited

artduc's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare

Recent Badges

0

Reputation

  1. I wrote a scriptlet for text rotation in any degress. It created an image containing the rotated text which is then used in the layout. Look there: http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=52656#99620
  2. Hi guys. After reading that thread I wrote a scriptlet for rotation of text. It works quite nice, even if the scriptlet seems to find no Open Type Fonts and some character parts appear a little pixilated (although I used antialiasing). But its good enough that our customer will use it for 10.000 prints per month. The code is long only because of a text wrapping algorithm. Tell me if you need a version without wrapping. After registering the class in classpath (e.g. via the jar archive I have attached: In iReport Extras/Options/iReport/Classpath/Add JAR) all you have to do in layout is the following: 1. Add attribute: <jasperReport ... scriptletClass="RotateTextScriptlet" ... > 2. use it in image element. Example: <image scaleImage="RealSize" hAlign="Center" vAlign="Middle"> <reportElement x="26" y="16" width="162" height="162"/> <imageExpression class="java.awt.Image"><![CDATA[$P{REPORT_SCRIPTLET}.rotateText( $V{SpecialDescription},new java.awt.Font("Sans Serif",1,100), 365, 365, 350, java.awt.Color.white)]]></imageExpression> </image> Note: The image must lead to the java interface type "java.awt.Image" and not "java.lang.String", which is used when referring to an image file. The scriptlet returns an image implementing that interface. I hope this will help you out! PS: For any RGB Colors of the text use "new java.awt.Color(R,G,B)" instead of "java.awt.Color.white" which is a constant. Any value can be 0 to 255, so "java.awt.Color.white" is the same like "new java.awt.Color(255,255,255)" RotateTextScriptlet.java: Post Edited by artduc at 07/18/2012 10:03 Post Edited by artduc at 07/18/2012 10:04 Post Edited by artduc at 07/18/2012 10:14 Post Edited by artduc at 07/18/2012 10:18
×
×
  • Create New...