PhraseInaChunkPDF.java Source code

Java tutorial

Introduction

Here is the source code for PhraseInaChunkPDF.java

Source

import java.io.FileOutputStream;

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

public class PhraseInaChunkPDF {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter.getInstance(document, new FileOutputStream("PhraseInaChunkPDF.pdf"));

            document.open();

            Phrase phrase = new Phrase(new Chunk("this is a phrase in a chunk\n"));
            document.add(phrase);
        } catch (Exception ioe) {
            System.err.println(ioe.getMessage());
        }
        document.close();
    }
}