MainClass.java Source code

Java tutorial

Introduction

Here is the source code for MainClass.java

Source

import java.io.FileOutputStream;

import com.lowagie.text.Document;
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 writer6 = PdfWriter.getInstance(document, new FileOutputStream("two_page_right.pdf"));
        writer6.setPdfVersion(PdfWriter.VERSION_1_5);
        writer6.setViewerPreferences(PdfWriter.PageLayoutTwoPageRight);

        document.open();
        Paragraph hello = new Paragraph("(English:) hello, ");
        document.add(new Paragraph("asdf"));
        document.add(hello);
        document.close();
    }
}