using System;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
public class font_selector
{
    
    [STAThread]
    
public static void  Main(string[] args)
    {
        
try
        {
            Document document 
= new Document();
            PdfWriter writer 
= PdfWriter.GetInstance(document, new FileStream(@"e:\java\font_selector.Pdf", FileMode.Create));
            document.Open();
            
string text = "This text is the first verse of \u275dThe Iliad\u275e. It's not polytonic as it should be " 
                
+ "with \u2798 and \u279a entoation variants but that's all we have for now.\n\n" 
                
+ "\u2766\u00a0\u00a0\u039c\u03b7\u03bd\u03b9\u03bd \u03b1\u03b5\u03b9\u03b4\u03b5,"
                
+ "\u03b8\u03b5\u03b1, \u03a0\u03b7\u03bb\u03b7\u03b9\u03b1\u03b4\u03b5\u03c9 \u0391"
                
+ "\u03c7\u03b9\u03bb\u03b7\u03bf\u03c2";
            FontSelector sel 
= new FontSelector();
            sel.AddFont(
new Font(Font.TIMES_ROMAN, 12));
            sel.AddFont(
new Font(Font.ZAPFDINGBATS, 12));
            sel.AddFont(
new Font(Font.SYMBOL, 12));
            Phrase ph 
= sel.Process(text);
            document.Add(
new Paragraph(ph));
            document.Close();
        }
        
catch (System.Exception de)
        {
            System.Console.Error.WriteLine(de.Message);
        }
        System.Console.Out.WriteLine(
"Fim.");
    }
}
posted on 2006-07-24 11:18  RubyPDF  阅读(1370)  评论(6编辑  收藏  举报