I am using iTextSharp 5.3.2.0 to add information to an existing PDF file containing the W-2 form. Everything works fine, and the PDF file looks great when writing to the browser response stream; however, when the user views the PDF file, he asks: "Do you want to save the changes to" W2.pdf "before closing?" every time he views a document from a web page.
In an attempt to narrow the problem down to the end, I actually stripped all my modifications, but the problem continues. Here's a simple version of my code when my data write request is commented out:
PdfReader pdfReader = new PdfReader(dataSource.ReportTemplate);
using(MemoryStream outputStream = new MemoryStream())
using (PdfStamper pdfStamper = new PdfStamper(pdfReader, outputStream))
{
pdfStamper.FormFlattening = true;
return outputStream;
}
"" PDF , : " ", Acrobat.
, - PDF. , PDF , " " .
byte[] bytes = File.ReadAllBytes(dataSource.ReportTemplate);
using (MemoryStream outputStream = new MemoryStream())
{
outputStream.Write(bytes, 0, bytes.Length);
return outputStream;
}
, iTextSharp - "" PDF , iTextSharp - .
FWIW, Acobat Reader 10.1.4, .
EDIT: PDF , , 80K. , , PDF, iTextSharp, 150 . , "" " ", Acrobat Reader, 80K. iTextSharp - .