MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;

public class MainClass {
    public static void main(String[] args) throws Exception {
        Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
        document.open();
        Chunk fox = new Chunk(Image.getInstance("fox.gif"), 0, -15);
        Chunk dog = new Chunk(Image.getInstance("dog.gif"), 0, -15);
        Paragraph p = new Paragraph("Quick brown ");
        p.add(fox);
        p.add(dog);
        document.add(p);
        document.close();
    }
}