I am attempting to do something which seems like it should be simple and
straight-forward, yet I've had great difficulty with. I am trying to
read an existing PDF document and use the AcroFields component of iText
to change some of the data in the fields, then send the result back to
the browser as a stream of data. The short program that I have compiles
fine, but when I try to load the webform in my browser (either Firefox
or IE), I get a 'The file is damaged and could not be repaired' error. I
am using C#, iTextSharp, and .NET 2003. Any help on this would be
greatly appreciated. Here's the iText-related portion of my code:
PdfReader reader = new
PdfReader("http://localhost/WebProject1/testForm.pdf");
MemoryStream stream = new MemoryStream();
PdfStamper stamp = new PdfStamper(reader, stream);
AcroFields acroFields = stamp.AcroFields;
acroFields.SetField("Employee.firstName", "Martin");
acroFields.SetField("Control.printOnly", "false");
acroFields.SetField("Control.serverURL",
"http://www.myurl.com");
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Length", stream.Length.ToString());
Response.OutputStream.Flush();
Response.OutputStream.Close();
Response.End();
stamp.Close();
--
= = = = = = = = = =
Tim Wirtz
Application Support Specialist
Symmetry Software
www.Symmetry.com
www.PaycheckCity.com
www.StateW4.com
www.Payroll-Taxes.com
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions