IText学习手册——通过Paragraph输出内容

Paragraph继承自Phrase,他和Phrase的区别有点象<div>同<input>的区别,及在同一个document中加入多个Phrase时,多个Phrase实在同一行,如果是加入多个Paragraph,过个Paragraph实在不同的行

/// <summary>
        /// 使用paragraph输出内容
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button15_Click(object sender, EventArgs e)
        {
            Document doc = new Document();
            PdfWriter.GetInstance(doc, File.Open(path, FileMode.Create));
            doc.Open();
            Paragraph paragraph = new Paragraph();
            doc.Add(new Paragraph("This is first paragraph"));
            doc.Add(new Paragraph("This is second paragraph"));
            doc.Close();
        }

显示效果:

image

posted @ 2014-02-26 15:24  争世不悔  阅读(1822)  评论(0编辑  收藏  举报