import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Font;
import com.lowagie.text.PageSize;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.MultiColumnText;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args) throws Exception {
Document document = new Document(PageSize.A4);
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
BaseFont bf = BaseFont.createFont("c:/windows/fonts/arial.ttf", BaseFont.IDENTITY_H, true);
Font font = new Font(bf, 14);
MultiColumnText mct = new MultiColumnText();
mct.addSimpleColumn(36, PageSize.A4.width() - 36);
mct.setRunDirection(PdfWriter.RUN_DIRECTION_RTL);
mct.addElement(new Paragraph("\u05e0\u05d9\u05e0\u05d4", font));
document.add(mct);
document.close();
}
}
|