下面介绍下怎么添加属性,代码如下:

 

protected void Button1_Click(object sender, EventArgs e)
        {
 
            Document doc = new Document();
           
            try
            {
                PdfWriter.GetInstance(doc, new FileStream(Server.MapPath("Elaine.pdf"), FileMode.Create));            
                doc.Open();
                doc.AddTitle("bestTitle");//标题
                doc.AddSubject("TestPDF");//主题
                doc.AddKeywords("PDF");//关键字
                doc.AddAuthor("Elaine");//作者
                doc.AddCreationDate();//创建时间
                doc.Add(new Paragraph("Today is my second time to create a PDF!")); //为当前的文档添加内容
 
            }
            catch (Exception DOCEx)
            {
 
                Response.Write(DOCEx.Message);
            }
            finally
            {
                if (doc.IsOpen())
                {
                    doc.Close();
                }
            }
 
        }

效果图:

公司里面用的iTextSharp(教程)---关于PDF的属性设置

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-01-16
  • 2021-07-30
  • 2021-09-16
猜你喜欢
  • 2022-12-23
  • 2021-10-02
  • 2021-10-30
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案