import java.io.FileOutputStream;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.HyphenationAuto;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document(PageSize.A6);
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
document.setMarginMirroring(true);
Chunk ck = new Chunk("this is a test");
HyphenationAuto auto = new HyphenationAuto("en", "GB", 2, 2);
ck.setHyphenation(auto);
Paragraph p = new Paragraph(ck);
p.setAlignment(Paragraph.ALIGN_JUSTIFIED);
document.add(p);
document.close();
}
}
|