import java.lang.*;
import java.io.*;
import java.util.*;
import java.text.*;

import com.pdfjet.*;


/**
 *  Example_07.java
 *
 */
public class Example_07 {

    public Example_07() throws Exception {
        PDF pdf = new PDF();

        pdf.setFontPath("fonts/Gentium102");
        Font f1 = new Font(pdf,
                "GenR102.ttf", CodePage.UNICODE, Embed.YES);

        Page page = new Page(pdf, Letter.PORTRAIT);

        f1.setSize(18);
        int x_pos = 70;
        int y_pos = 10;
        TextLine text = new TextLine(f1);
        text.setPosition(x_pos, y_pos);
        StringBuilder buf = new StringBuilder();
        for (int i = 0x20; i < 0x7F; i++) {
            if (i % 16 == 0) {
                text.setText(buf.toString());
                text.setPosition(x_pos, y_pos += 24);
                text.drawOn(page);
                buf = new StringBuilder();
            }
            buf.append((char) i);
        }

        y_pos += 24;
        buf = new StringBuilder();
        for (int i = 0x390; i < 0x3EF; i++) {
            if (i % 16 == 0) {
                text.setText(buf.toString());
                text.setPosition(x_pos, y_pos += 24);
                text.drawOn(page);
                buf = new StringBuilder();
            }
            buf.append((char) i);
        }

        y_pos += 24;
        buf = new StringBuilder();
        for (int i = 0x410; i < 0x46F; i++) {
            if (i % 16 == 0) {
                text.setText(buf.toString());
                text.setPosition(x_pos, y_pos += 24);
                text.drawOn(page);
                buf = new StringBuilder();
            }
            buf.append((char) i);
        }

        pdf.wrap();
        pdf.save("Example_07.pdf");
    }


    public static void main(String[] args) throws Exception {
        new Example_07();
    }

}   // End of Example_07.java
