Friday 18, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Saturday, 27 May 2017

iText 5 PDF Chunk - StandardDeviation Symbol Example

To create PDF file we need iText 5 jar. Download iText Jars from iText Website or Maven Repository

Maven Dependency

2.<dependency>
3.    <groupid>com.itextpdf</groupid>
4.    <artifactid>itextpdf</artifactid>
5.    <version>5.5.11</version>
6.</dependency>
7.  

StandardDeviation.java
01.package com.javatutorialcorner.itextpdf;
02. 
03.import com.itextpdf.text.Chunk;
04.import com.itextpdf.text.Document;
05.import com.itextpdf.text.DocumentException;
06.import com.itextpdf.text.Font;
07.import com.itextpdf.text.Font.FontFamily;
08.import com.itextpdf.text.Paragraph;
09.import com.itextpdf.text.pdf.PdfWriter;
10.  
11.import java.io.File;
12.import java.io.FileOutputStream;
13.import java.io.IOException;
14. 
15.public class StandardDeviation {
16.  
17.    public static final String DEST = "C:/JTC/StandardDeviation.pdf";
18.  
19.    public static void main(String[] args) throws IOException, DocumentException {
20.        File file = new File(DEST);
21.        file.getParentFile().mkdirs();
22.        new StandardDeviation().createPdf(DEST);
23.    }
24.    public void createPdf(String dest) throws IOException, DocumentException {
25.        Document document = new Document();
26.        PdfWriter.getInstance(document, new FileOutputStream(dest));
27.        document.open();
28.        document.add(new Paragraph("The standard deviation symbol doesn't exist in Helvetica."));
29.        Font symbol = new Font(FontFamily.SYMBOL);
30.        Paragraph p = new Paragraph("So we use the Symbol font: ");
31.        p.add(new Chunk("s", symbol));
32.        document.add(p);
33.        document.close();
34.    }
35.  
36.}

Output

Reference : iText Website

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • How to Split the String in JavaFollowing Example shows how to split the string using str.split(String pattern) method in Java. Sample Programpackage com.javatutorialcorner.javastring;public class SplitString { public static void main(String[] args) { … Read More
  • How to convert a String to Lower caseFollowing example shows how to convert a string to lower case. Sample Programpackage com.javatutorialcorner.javastring;public class ToLowerCase { public static void main(String[] args) { String input = "Java tutoria… Read More
  • Java StAX Parser – Cursor API Read ExampleIn this tutorial we are going to see about StAX cursor API to read an XML document. In the Cursor example, the application instructs the parser to read the next event in the XML input stream by calling next(). Note that next(… Read More
  • How to add value to all types of Collections Following example shows how to add values in all types collections in Java. Sample Program AddValueToCollection.java package com.javatutorialcorner.collection; import java.util.ArrayList; import java.util.Collection; impo… Read More
  • How to change File Last modified Date using Java Following example shows how to change file last modified date using file.setLastModified() method in Java. setLastModifiedpublic boolean setLastModified(long time)  Sets the last-modified time of the file or directory … Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: iText 5 PDF Chunk - StandardDeviation Symbol Example Rating: 5 Reviewed By: eHowToNow