Required jars:

  • itext-1.1.4.jar
  • itext-rups-2.1.3.jar
  • jdtaus-editor-client-application-1.0-beta-10.jar
  • PDFRenderer.jar

package com.liferay;


import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class TextToPDF{
public static void main(String arg[]){
InputStreamReader in= new InputStreamReader(;
BufferedReader bin= new BufferedReader(in);
System.out.println("Enter text:");
String text=bin.readLine();
Document document = new Document(PageSize.A4, 36, 72, 108, 180);
PdfWriter.getInstance(document,new FileOutputStream("E:/workspace/rnd/javarnd/pdfFile.pdf"));;
document.add(new Paragraph(text));
System.out.println("Text is inserted into pdf file");
}catch(Exception e){}

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: