PdfVersion1_2.java Source code

Java tutorial

Introduction

Here is the source code for PdfVersion1_2.java

Source

import java.io.FileOutputStream;

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

public class PdfVersion1_2 {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("PDFversion1_2.pdf"));
            writer.setPdfVersion(PdfWriter.VERSION_1_2);
            document.open();
            document.add(new Paragraph("This is a PDF-1.2 document"));
        } catch (Exception ioe) {
            System.err.println(ioe.getMessage());
        }
        document.close();
    }
}