Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Skewing Text 
 

In this section, you will learn how to make a program by which you can set skew in for chunk. iText api provides a method setSkew(float value1,float value2).This method is used in palce of italic font.

 

Skewing Text    

                         

In this section, you will learn how to make a program by which you can set skew in for chunk. iText api provides a method setSkew(float value1,float value2).This method is used in palce of italic font.   

Code Description:
We can use the method setSkew(float alpha,float beta) in place of italic fonts (if we are using a font that doesn,t  support  Font.ITALIC). We take 0f as alfa and 12f as value for beta.Alfa is the angle of the baseline in degrees. In the example, we rotate some text 45f and -45f degrees. Beta is the square-angle on the baseline.

The code of the program is given below:

import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class exampleOfSkew {
  public static void main(String[] args)throws Exception
                {
    System.out.println("Example of Skew");
    Document document = new Document();
      PdfWriter.getInstance(document,new FileOutputStream("Skew.pdf"));
      document.open();
      Paragraph p = new Paragraph("Rose India.net");
      document.add(p);
      Chunk chunk = new Chunk("Rose India.net");
      chunk.setSkew(45f0f);
      document.add(chunk);
      document.add(Chunk.NEWLINE);
      chunk.setSkew(0f45f);
      document.add(chunk);
      document.add(Chunk.NEWLINE);
      chunk.setSkew(-45f0f);
      document.add(chunk);
      document.add(Chunk.NEWLINE);
      chunk.setSkew(0f, -45f);
      document.add(chunk);
      document.add(Chunk.NEWLINE);
      chunk.setSkew(16f35f);
      document.add(chunk);
      document.add(Chunk.NEWLINE);
      Chunk italic = new Chunk("This looks like Font.ITALIC");
      italic.setSkew(0f15f);
      document.add(italic);      
    document.close();
  }
}

The output of the program is given below:

Download this example.

 

                         

» View all related tutorials
Related Tags: c web pdf file stl text application import jar diff io make packages port this package itext app if tex

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.