NegativeLeadingPDF.java Source code

Java tutorial

Introduction

Here is the source code for NegativeLeadingPDF.java

Source

import java.io.FileOutputStream;
import java.io.IOException;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Phrase;
import com.lowagie.text.pdf.PdfWriter;

public class NegativeLeadingPDF {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter.getInstance(document, new FileOutputStream("NegativeLeadingPDF.pdf"));
            document.open();
            document.add(new Phrase(16,
                    "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));
            document.add(new Phrase(-16,
                    "Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text "));
        } catch (Exception ioe) {
            System.err.println(ioe.getMessage());
        }
        document.close();
    }
}