我将创建pdf作为显示....我想在用户输入文本框值时读取该值 [英] i will create pdf as display ....i want to read textbox values when user enter that value

查看:70
本文介绍了我将创建pdf作为显示....我想在用户输入文本框值时读取该值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Unnamed2_Click(object sender, EventArgs e)
   {
       var document = new Document(PageSize.A4, 50, 50, 25, 25);

       var output = new FileStream(Server.MapPath("~/PDFTemplate/SimpleFormFieldDemo.pdf"), FileMode.Create);
       var writer = PdfWriter.GetInstance(document, output);


       document.Open();

       var table = new PdfPTable(2);
       table.DefaultCell.Border = 0;

       table.AddCell("helloooooo:");
       var nameField = new TextField(writer, new Rectangle(0, 0, 200, 10), "name");
     //  nameField.BackgroundColor = Color.YELLOW;

       var nameCell = new PdfPCell();
       nameCell.CellEvent = new FieldPositioningEvents(writer, nameField.GetTextField());
       table.AddCell(nameCell);


       table.AddCell("Friend.............:");
       var ageField = new TextField(writer, new Rectangle(0, 0, 50, 10), "age");
      //   ageField.BackgroundColor = Color.YELLOW;

       var ageCell = new PdfPCell();
       ageCell.CellEvent = new FieldPositioningEvents(writer, ageField.GetTextField());
       table.AddCell(ageCell);

       document.Add(table);

       document.Close();

    //   pnlViewPDF.Visible = true;
       ClientScript.RegisterStartupScript(this.GetType(), "blah", "alert('PDF created!');", true);

   }






//将显示为pdf

helloooooo:TextBox1
朋友....:TextBox2






// it will display in pdf

helloooooo: TextBox1
Friend....: TextBox2

推荐答案

确定,是否已授予权限?

既然您还没有对遇到的问题发表任何意见,所以不可能告诉您任何有用的信息.

如果您在创建PDF文件时遇到问题,建议您找到专用于所用PDF库的支持论坛.由于我们也不知道那是什么,因此无法通过链接将您指向该方向.
OK, permission granted?

Since you haven''t said anything about what kind of problem you''re having so it''s impossible to tell you anything useful.

If you''re having problems with the creating the PDF file, I suggest you find the support forum dedicated to the PDF library you''re using. Since we don''t know what that is either, it''s impossible to point you in that direction with a link.


这篇关于我将创建pdf作为显示....我想在用户输入文本框值时读取该值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆