// This code help to create a PDF file using java. that is stored in given file location.
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.util.Date;
import com.lowagie.text.Document;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
public class pdfGeneration {
public static void main(String[] args) {
try {
OutputStream file = new FileOutputStream(new File("C:\\newPDF.pdf")); //Saved file path
Document document = new Document();
PdfWriter.getInstance(document, file);
document.open();
document.add(new Paragraph("Welcome to TECHIE SNACKS, Author Balamurugan.M.R"));
document.add(new Paragraph("This is simple pdf generation code \n Created on \t"+ new Date().toString()));
document.close();
file.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
Notes: Please and Must include the " iText-2.1.5" jar file then only it works.
You will find the jar in given location " http://grepcode.com/snapshot/repo1.maven.org/maven2/com.lowagie/itext/2.1.5 ".
Enjoy the life :)
Subscribe to:
Post Comments (Atom)
Backup files to google drive using PHP coding
Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...
-
Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...
-
Hi ALL, Here I wrote a program for Void Method in java. /** * * @author Balamurgan M */ public class voidMethod { ...
-
Hi Guys, Course Backup. 1. Go into the course. 2. Click the Backup link either in the gear menu or the Administration b...
No comments:
Post a Comment