如何在Pdf文档中添加Aspx控件值? [英] How Do I Add Aspx Controls Values In Pdf Document?

查看:123
本文介绍了如何在Pdf文档中添加Aspx控件值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的页面中,我有一个文本框和一个Button.When我在文本框中输入文本并按提交按钮,文本框值将添加到Pdf文档中,如



输入你的名字:奔驰



但我的问题是,当我按下提交按钮时,数据将被附加在PDF文档中的图像上方。我想要显示在文档的中间。

请帮助我....

我的代码是

Here in my page i have one Textbox and one Button.When i enter the text in textbox and press Submit button the Textbox value will be added in Pdf Document like

Enter u r Name:Benz

but my problem is when i press the submit button the data will be append on above the image in PDF Document.i want to display in the middile of the Document.
pls help me....
My Code is

Response.ContentType = "application/pdf";
Response.AddHeader("content-disposition", "attachment;filename=Reports in PDF.pdf");
Response.Cache.SetCacheability(HttpCacheability.NoCache);
 StringWriter sw = new StringWriter();
sw.Write(lbl1.Text + ":" + txt1.Text);
HtmlTextWriter hw = new HtmlTextWriter(sw);
this.Page.RenderControl(hw);
StringReader sr = new StringReader(sw.ToString());
Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
pdfDoc.Open();
htmlparser.Parse(sr);
pdfDoc.Close();
Response.Write(pdfDoc);
Response.End();



显示如

姓名:BEnz

IMage

Nmae:

i希望在Name的前面显示文本框值。

请帮我搜索这么多文章。但我没有得到答案。

请帮助我.....


it shows like
Name:BEnz
IMage
Nmae:
i want to display the textbox value in fron of Name.
pls Help me i search so many articles.but i didnt get answer.
pls help me.....

推荐答案

您好,



您可以使用'WkHtmltoPdf .exe'将您的html文件转换为PDF文件。
Hi,

You can use 'WkHtmltoPdf.exe' to convert your html file to PDF file.


这篇关于如何在Pdf文档中添加Aspx控件值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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