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 TrueTypeFromTTFFilePDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream("TrueTypeFromTTFFilePDF.pdf"));
document.open();
BaseFont bfComic = BaseFont.createFont("c:\\windows\\fonts\\arial.ttf", BaseFont.CP1252,
BaseFont.NOT_EMBEDDED);
Font font = new Font(bfComic, 12);
String text1 = "arial.ttf";
document.add(new Paragraph(text1, font));
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}
|