无法在Pdf中添加文本框 [英] Unable to add Text box in Pdf

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

问题描述

大家好,

我在pdf中使用HTMLWorker( 文本框' > iTextSharp.dll )



代码:



文件pdfDoc =  new  Document(); 
pdfDoc.Open();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new
iTextSharp.text.html.simpleparser.HTMLWorker(pdfDoc);
string sttt = <输入类型='text'name ='firstname'value ='Hello />;
hw.Parse( new StringReader(sttt));
pdfDoc.Close();

解决方案

如果要在PDF文件中添加文本框,请使用看这里:

http://stackoverflow.com/a/13191097/ [ ^ ]







我发现它无法正常工作的原因:你的HTML代码格式不正确,因为属性未关闭:缺少撇号。

试试这个:

  string  sttt =  < input type ='text'name ='firstname'value ='Hello' />中; 


Hi all,
I am unable to display 'Text Box' in pdf while converting html string to pdf using HTMLWorker(iTextSharp.dll)

Code:

Document pdfDoc = new Document();
pdfDoc.Open();
iTextSharp.text.html.simpleparser.HTMLWorker hw = new
iTextSharp.text.html.simpleparser.HTMLWorker(pdfDoc);
string sttt = "<input type='text' name='firstname' value='Hello/>";
hw.Parse(new StringReader(sttt ));
pdfDoc.Close();

解决方案

If you want to add a text box to your PDF file, then have a look here:
http://stackoverflow.com/a/13191097/[^]

[EDIT]

I found the reason why it is not working: your HTML code is not well-formed, because the value attribute is not closed: there's an apostrophe missing.
Try this:

string sttt = "<input type='text' name='firstname' value='Hello'/>";


这篇关于无法在Pdf中添加文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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