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
 
 
Search All Tutorials
  

 
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
 
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Examples of iText

                         

  1. Write Hello in the pdf file
    In this program we are going to tell you how you can write a "Hello" word in a pdf file irrespective of the fact whether it exists or not.
                           
  2. How to adjust a size of a pdf file
    In this program we are going to tell you how we can adjust the size of a pdf file irrespective of the fact whether it exists or not. If it exists then its fine, otherwise a pdf file will be created.   
                        
  3. A4 size
    In this program we are going to tell you how we can automatically assign the right values for a A4 size to the document instance. Its options are from A0 to A10.      
                    
  4. pdf default size
    In this program we are going to tell you how we can automatically set the default size of pdf. Its options are from A0 to A10. These text explains the ISO 216 paper size system and the ideas behind its design.
                               
  5. Inserting image in the pdf file
    In this program we are going to tell you how we can insert a image in a pdf file irrespective of the fact whether it exists or not. If it exists, fine otherwise it will get automatically created. 
                                
  6. How to wrap image in the pdf file
    In this program we are going to tell you how we can insert a image  and wrap it according to your own style in a pdf file irrespective of the fact whether it exists or not. If it exists, fine otherwise it will get automatically created.
                         
  7. How to make a Rectangle type pdf
    In this program we are going to tell you how we can make a pdf file in the rectangle shape irrespective of the fact whether it exists or not. If it exists then its fine, otherwise a pdf file will be created. 
                   
  8. pdf background color
    In this program we are going to tell you how we can change the background of the pdf file as well as the size of a pdf file irrespective of the fact whether it exists or not. If it exists then its fine, otherwise a pdf file will be created.
                                                
  9. pdf tables
    In this program we are going to tell you how we can make a table in a pdf file irrespective of the fact whether it exists or not. If it exists then its fine, otherwise a pdf file will be created. 
                        
  10. pdf Table title
    In this program we are going to tell you how the title will be given to the table of the pdf file. Suppose we have one pdf file in which we have a table and we want to give a title to it.
                                      
  11. pdf section
    In this program we are going to tell you how you can divide a pdf file into sections irrespective of the fact whether it exists or not.
                
  12. pdf chapter
    As we all have seen a pdf file, in the pdf file there are too many chapter. Do you want to make them by your own. In this program we are going to tell you how you can make different chapters in pdf file irrespective of the fact whether it exists or not.
                        
  13. pdf list
    In this program we are going to know how we can make a list in a pdf file irrespective of the fact whether it exists or not.
                                        
  14. itext chunk
    In this free tutorial we are going to tell you about chunk in iTextiText is a framework for creating pdf files in java. A Chunk is the smallest significant part of the text that can be added to a document. 
                              
  15. combine two pdf files
    In this program we are going to tell you how you can read a pdf file and combine more than one pdf into one. 
                
  16. hello world pdf
    In this program we are going to tell you how you can write a simple "Hello World" word in a pdf
    , rtf and html file irrespective of the fact whether it exists or not.
                            
  17. How to write hello world by using multiple writers in pdf
    To make a program over this, firstly we need to import some packages. Remember to make this program the first and foremost thing to remember is to place the iText.jar in WEB-INF/lib of your web application.
                  
  18. pdf system
    In this example we are going to see how the data which we have in the pdf file will be printed on the command prompt.
                     
  19. pdf landscape
    In this free tutorial we are going to tell you about landscape portrait in iTextiText is a framework for creating pdf files in java. In this tutorial you will know more about the landscape portrait. 
                           
  20. pdf margin
    In this example we are going to see how we can give a margin to our pdf file. Margin gives the file good look and feel. After going through this example you will be able to give the margins to your own made pdf file.    
                      
  21. pdf Metadata
    In this program we are going to know what is metadata in pdf. Metadata is data about something, whether it is an object, person, or any other data.
      
  22. itext version 
    In this program we are going to find the version of iText jar file which we are using to make a pdf file through java program.
      
  23. pdf file measurement
    In this program we are going to display the measurement of pdf   pages   through java program.The values are added into paragraphs
    and added into the documents. These values are stored in pdf file.
       

  24. Insert pages pdf
    In this program we are going to insert new blank pages in pdf  file  through java program
           
  25. Changing PDF Version 
    In this program we are going to change  the version of pdf file  through java program.
                                             
                                                           
  26. Concatenate two Pdf Files 
    In this program we are going to concatenate pdf files into a  pdf files through java program. The all data of files  are concatenated into
    destination pdf. You can concentrate two  into a single file. 
       
  27. Concatenate More Than two Pdf Files
    In this program we are going to concatenate more than two pdf files into a destination pdf files through java program. The all data of all files  are  concatenated into destination pdf. You can concentrate two or more file into a single file.
              
  28. Rotating image in the pdf file
    I
    n this program we are going to tell you how we can insert a image  and rotate it according to your own style in a pdf file irrespective of the fact whether it exists or not. 
                                           
  29. Hello Word " on PDF,RTF and HTML format
    In this program we are going to tell you how we can create three file rtf,pdf and html files.And we are printing here Hello Word on PDF, HTML, And RTF format.
                        
  30. Adding Under Lines 
    In this program we are going to tell you how you can add underlines. You can  any number of lines. This example gives you an idea ,how to make a java program to add a underline and you can also make program for making line on the text.
                
  31. Changing Background Color
    In this program, we are going to tell you how you can change background color of a pdf file. You can change the background color of any chunk with the help of setBackground(Color color).
                              
  32. Changing Chunk Color
    In this program we are going to tell you how you can change the color of chunk color .This example tell you how you can change the color of chunk and how you can add fonts and gives the size of the fonts.
                                            
  33. Creating Multiple lines
    iText API,s provides facility to  make the lines. In this program we are going to tell you how you can makes single  lines and how you can make multiple lines into the pdf files. You can make multiple lines and also make  colorful lines by using this example.
                                          
  34. Creating Multiple Lists 
    In this program we are going to tell you how you can make lists into a pdf files. You can make lists and also make  sublist You can make ordered list or symbolic list. iText API,s  provides facility to make list. List may be ordered  or list may be unordered. Depending on our requirement we can create both types of list. We can add a symbols as list.
                                   
  35. Using Different Fonts 
    In this program, we are going to give example of ,how you can use different font. You can add different font in the paragraph. We pass two parameters into the paragraph. First one is chunk text and second is font.
                                
  36. Use Of Font Selector 
    In this section ,you will learn how to use FontSelector. That means if you want to keep some text in different font like  "Times TIMES_ROMAN", "ZAPFDINGBATS" etc. particularly.
                    
  37. How You Can Use Phrase
    In this section, you will learn how to design some text according to our need by use of Phrase. We can format our pdf by using Phrase() constructor. We can add the text, Chunk and set the font size , name and style of the font.
                
  38. End of Line
    In this section, you will learn how to make a program by which you can define the strokeWidth and strokeColor.You can learn also to change the outline of the text. You can define the width and the color of the strokes used to draw the character. iText api provides a method setTextRenderMode(int mode,float strokeWidth,Color strokeColor). 
                                               
  39. Rendering
    In this section, you will learn how to make a program by which you can make a render page. iText api provides a method setTextRenderMode(int mode,float strokeWidth,Color strokeColor).We can gives various color and int mode.
                                                                       
  40. Skewing
    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.
                                 
  41. Creating superscript and subscript 
        In this section, you will learn how we can create  the subscript and superscript.  iText api provides a setTextrise(float value1) method to set the position of text. We can set  float value as positive or negative .Positive value is used for  Superscript and negative value used for subscript.
            
  42. Uses Of chunk Object
    In this section, you will learn how we can change the background color  and how we can create  the subscript and superscript.  iText api provides a setTextrise(float value1) and setBackground(Color  color) method to set the position of text and to set the background. We can set  float value as positive or negative .Positive value is used for  Superscript and negative value used for subscript.  
      
  43. Measure Of Width
    In this section, you will learn how we can measure the width of the page.  iText api provides a getWidthPoint() to know the width of the page. The width will be in centimeters or inches
         .
  44. Negative Leading 
    In negative leading  you will learn how we can overlap a text using negative and positive leading values in  Phrase constructor. You can make shadow of any text. For this you have just change the values of  the leading in Phrase constructor and the text.
           
  45. Making Paragraph And Set Alignment 
    In this example , we are going to explain how we can make paragraph and how we can gives various alignment. To make a paragraph we use Paragraph("Text") constructor . To gives alignment we use setAlignment(int alignment).
              
  46. Set Space Ratio And Alignment
    In this example , we are going to explain how we can set space ratio and how we can gives various alignment. You can make pdf with no space between the characters of a word .

      
  47. Symbol Substitution:
    In this example , we are going to explain how we can make symbols using iText api,s. We are using integer values which will  converted it into symbol. For this we just convert the integer value into its character value.
           
  48. Add Content of an iText PDF File using java code
    In many applications there is a need to generate pdf file dynamically. The iText library can be used to generate PDF documents from Java program.
      

Back To Java Home.

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

5 comments so far (post your own) View All Comments Latest 10 Comments:

Hi,

I want to set the background image to pdf doc,

is it possible?...any help is appriciated,

thanks in advance.

regards,

Sunil

Posted by Sunil on Tuesday, 09.23.08 @ 02:33am | #80614

Hi,
I'm trying to open up an existing .pdf file (not create a new one) and apply text to a particular area, say using x & y coordinates.
I'm looking for a simple example please.

Posted by Mike on Tuesday, 08.5.08 @ 00:27am | #70982

Hi,

the following is my code for setting a hyperlink to a cell in a table.

------------------ code starts ------------------

private static Table makeTableFromMap(final String firstColumnTitle, final String secondColumnTitle, final java.util.Map m){
Table tab = null;

try{
tab = new Table(2);
}
catch(BadElementException ex){
throw new RuntimeException(ex);
}

tab.setBorderWidth(1.0f);
tab.setPadding(1);
tab.setSpacing(0);

tab.addCell(new Cell(firstColumnTitle));
tab.addCell(new Cell(secondColumnTitle));

tab.endHeaders();

if (m.keySet().size() == 0){
Cell c = new Cell("none");
c.setColspan(2);
tab.addCell(c);
}
else{
Iterator iter = m.keySet().iterator();
while (iter.hasNext()){
String strName = (String) iter.next();
Object value = m.get(strName);
String strValue = null;
if (value == null){
strValue = "";
}
else if (value instanceof String[]){
String[] aValues = (String[]) value;
strValue = aValues[0];
}
/*else if(value instanceof Chunk){
Chunk chunkValue = (Chunk)value;
strValue = chunkValue.getContent();
}*/
else{
strValue = value.toString();
}
Cell nameCell = new Cell(strName);
Cell valueCell = new Cell(strValue);

if(strValue.length() > 40){
int span = strValue.length() % 40;
nameCell.setRowspan(span);
valueCell.setRowspan(span);
}
tab.addCell(nameCell);
tab.addCell(valueCell);
}
}
return tab;
}

--------------------- code ends -----------------

This first parameter is a name(String) and the second parameter is its value(String). Now, if the value is a URL which is more than 40 characters long, I need to ensure that the rowspan of both values is increased accordingly. However, in doing so, the hyperlink for the value String is also truncated. Hence, if the hyperlink was 48 characters, it is changed to 40 characters and the URL does not open. Something like, http://www.google.com gets changed to

http://www.gooo <---- the wrong hyperlink
gle.com

How do i ensure that even after rowspan, the entire URL is not affected?

TIA

Posted by Sumeet on Thursday, 06.5.08 @ 14:37pm | #62179

I would like to create a PDF file using JSP/Servlet getting data from the database.I am looking for examples.

Thanks

Posted by Matthews on Sunday, 03.2.08 @ 23:08pm | #51043

how can I build a list in a table cell?
List list = new List(false, 10);
Paragraph p1 = new Paragraph();
list.add(new ListItem("111"));
list.add(new ListItem("222"));
list.add(new ListItem("333"));
p1.add(list);
document.add(p1); // this works

PdfPTable table3 = new PdfPTable(1);
PdfPCell cell = new PdfPCell();
cell.addElement(p1);
table3.addCell(cell);
document.add(table3); // this doesn't work no list is generated, rather a long text.

Posted by alutat on Tuesday, 09.11.07 @ 15:32pm | #26750

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.

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

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

Copyright © 2008. All rights reserved.