使用iTextsharp以pdf格式创建可编辑的表格,保存pdf格式的内容 [英] Create editable form in pdf using iTextsharp , save contents of pdf form
本文介绍了使用iTextsharp以pdf格式创建可编辑的表格,保存pdf格式的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用 kuujinbo 创建了可编辑的PDF,创建PDF后我可以编辑表单但不允许我以PDF格式保存表单,它给出了错误信息:你无法保存输入到此表单中的数据
如何创建PDF以便我可以保存表格数据到PDF?我希望生成的pdf与 irs
I have created editable PDF using kuujinbo , Once PDF is created i am able to edit the form but its not allowing me to save the form in PDF it gives error message : "you can not save data typed into this form"
How can i create PDF so that I can save the form data toPDF? I want generated pdf works same as irs
推荐答案
当然,我可能不完全理解你的问题。但是,我确实认为这不是一个错误本身,而是保存PDF表单的一般功能。我认为您必须执行另存为...以保存输入PDF表单的任何信息。
或者,我提供以下内容:
Granted, I may not completely understand your question. However, I do believe that is not an 'error' per se but the general function of saving a PDF Form. I think that you must do a 'Save As..." in order to save any information entered into a PDF form.
Alternatively, I offer the following:
using iTextSharp.text.xml;
using iTextSharp.text.pdf;
using iTextSharp.text;
...
public void XmlToPdf(string xmlDoc, string strFilename)
{
Document document = new Document();
MemoryStream os = new MemoryStream();
PdfWriter instance = PdfWriter.GetInstance(document, os);
StringReader input = new StringReader(xmlDoc);
XmlTextReader reader = new XmlTextReader(input);
ITextHandler handler = new ITextHandler(document);
try
{
handler.Parse(reader);
}
catch (Exception exception)
{
os.Close();
throw exception;
}
finally
{
reader.Close();
input.Close();
}
FileStream output = new FileStream(strFilename, FileMode.Create);
BinaryWriter writer2 = new BinaryWriter(output);
writer2.Write(os.ToArray());
writer2.Close();
output.Close();
os.Close();
}
根据 iText ,只能使用adobe软件生成这样的pdf。
As per iText , one can generate such pdf only by using adobe software.
这篇关于使用iTextsharp以pdf格式创建可编辑的表格,保存pdf格式的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文