import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Font;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfWriter;
public class MainClass {
public static void main(String[] args)throws Exception {
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream("2.pdf"));
document.open();
BaseFont bf;
Font font;
bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",
BaseFont.NOT_EMBEDDED);
font = new Font(bf, 12);
document.add(new Paragraph("test", font));
document.add(new Paragraph("Font: " + bf.getPostscriptFontName(),font));
document.add(new Paragraph("\u5341\u950a\u57cb\u4f0f", font));
document.close();
}
}
|