Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

different Font 

                         

In this program, we are going to give you an example that helps you for the procedure of using various fonts in a pdf document. Here, add(object) method of the Paragraph class is used to add text and it's font name with size.

Code Description:

The following method and fields are used for creating multiple colorful fonts.

add(Chunk chunk,Font font): The add method is used to add the chunk text and name of font with font size.

Following are some font name used in the given program:

  1. Font.ZAPFDINGBATS
  2. Font.TIMES_ROMAN
  3. Font.SYMBOL 

The code of the program is given below:

import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class exampleOfDifferentFonts{
      public static void main(String[] argsthrows Exception{      
          Document document = new Document();
          
PdfWriter writer = PdfWriter.getInstance(document,
new FileOutputStream("differentfontspdf.pdf"));
            document.open();
            Paragraph p = new Paragraph();
            p.add(new Chunk("This text is in Times Roman. "
new 
Font(Font.TIMES_ROMAN, 12)));
            p.add(new Chunk("This is ZapfDingbats: "
new 
Font(Font.ZAPFDINGBATS, 12)));
            p.add(new Chunk(". This is font Symbol: "
new 
Font(Font.TIMES_ROMAN, 12)));
            p.add(new Chunk("This text is in Times Roman."
new Font(Font.SYMBOL, 12)));
            document.add(new Paragraph(p));
            document.close();
    }
}

The output of the program is given below:

Download this example.

 

                         

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 
Latest Searches:
difference between arr
Photoshop Effects Smok
Photoshop Drawing Holl
breakÑ?Ð?Ð?Ñ??Ñ?Ð????Ñ
word in stirng
list duplicates hibern
two dimensional array
i-batis
PHP Date and time func
storedprocedure in ora
Linux Caixa Mпâ? ?пâ
delete hyperlink in gr
j2me insert image usin
Introduction to jquery
cinema 4d
how create mp3 player
data binding
breaké?«ê²¯?é?«???é?«ê
PL/]SQL
storing text data to a
How to write code for
JSTL API
scroll
spring hybernate eclip
tattoo efectes
javascript to Display
message box display
inno
Flex Custom mxml tags
merging pdf
difference between com
b tree implementation
JDBC and Mysql
s:if
MySQL Server as Linked
QtJambi
randomize
sun jdbc
ListIterator listItera
pass the form to more
Photoshop Photo Effect
awt example
what is static inner c
printing from jsf-page
how to run ruby applic
java programm for arra
jfreechart
JSP:File Browse
animation programme in
Getproperty
canonical path
<html:submit>
Passing Parameters in
Write a program that d
difference between inc
Copy One Database Tabl
ASPAdManagementRotatin
string functions in ja
UPDATE QUERY JAVA
ad
onloading the page ret
jcreator code of calcu
XMLBeans
assign flex label text
removing spaces betwee
convert unicode charac
goto
goto line
ASP EXAMPLE and char(1
include a file in dire
open close session
struts custom tag
insert data to html fi
resultsetmethods
how to split string c
break?ТÐ????????ТÐ??
asterisk
jQuery To Hide the Div
stored procedure in hi
how to reference index
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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 | 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.