Click here to Skip to main content
15,889,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
Posted
Updated 2-Apr-14 3:40am
v4

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();
		}
 
Share this answer
 
Comments
Dhyanga 31-Oct-16 15:15pm    
which version of itextsharp did you use?
As per iText , one can generate such pdf only by using adobe software.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900