PDF编程 itextsharp 创建一个Paragraph段落,添加文本到Paragraph,把Paragraph添加到文档中

by 亿答案 12. 十一月 2009 06:27

代码如下:

        public void Paragraph()
        {
            //设置Margin
            Document document = new Document(PageSize.A5, 10, 50, 100, 200);

            PdfWriter.GetInstance(document, new FileStream("E:\\MyDoc.pdf", FileMode.Create));

            document.Open();

            //创建一个Paragraph段落
            Paragraph paragraph = new Paragraph();
            paragraph.Alignment = Element.ALIGN_CENTER;

            FontFactory.Register("C:\\WINDOWS\\Fonts\\georgiab.TTF");//如果不是默认字体,需要先注册

            paragraph.Font = FontFactory.GetFont("Georgia", 36, Font.BOLD, Color.WHITE);//设置字体样式,颜色等,注意这里设置成了令人迷惑的白色
            for (int i = 0; i < 20; i++)
            {
                //添加文本到Paragraph
                paragraph.Add("Hello World, iTextSharp. ");
            }

            //把Paragraph添加到文档中
            document.Add(paragraph);

            document.Close();
        }

Tags: , , , ,

PDF编程, iTextSharp

评论

2010/4/3 2:05:03 #

replica watches

nice!

replica watches

2010/4/8 5:25:27 #

Dell t410

真的很棒哦!

Dell t410 People's Republic of China

2010/4/11 5:49:43 #

cheap brand shoes

This is something of a eulogy. I thought contacting its creator was the best way to let their lives end gracefully – in a full circle. They were unbelievable wholesale brand shoes, durable as all get-out and as stylish as Elvis on fire. It's time to let them go and move on to a new pair of cheap brand shoes. Like burying a family dog, setting them down is a hard task to do. But, alas, all things must end. http://www.freewholesale.net  

cheap brand shoes People's Republic of China

2010/5/8 15:58:40 #

黄山酒店

踏帖留痕!

黄山酒店 People's Republic of China

2010/5/11 19:06:19 #

ed hardy clothing

wansantg3hy

ed hardy clothing People's Republic of China

添加评论


(将显示你的Gravatar图标)

  Country flag

biuquote
  • 评论
  • 在线预览
Loading



Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

RecentComments

Comment RSS