Hi I'm using the method described in section 8.7 to append data to form fields using a stamper. As soon as I use the append=true parameter the output file is corrupt, that is it cannot be opened in either acrobat reader of FoxIt.
public static byte[] SetFormData(byte[] filedata, Dictionary<string,
string> formdata)
{
var reader = new PdfReader(filedata);
var ms = new MemoryStream();
var stamper = new PdfStamper(reader, ms, '\0', true);
var fields = stamper.AcroFields;
foreach (var key in formdata.Keys)
{
fields.SetField(key, formdata[key]);
}
stamper.Close();
reader.Close();
return ms.GetBuffer();
}
This is the code I'm using with version 5.0.5 of itextsharp.
The error in Acrobat reader reads: "There was an error opening this document.
The file is damaged and could not be repaired.
Best regards
Högni Gylfason
[cid:vislogo3012.gif]
Högni Gylfason
Hugbúnaðarsérfræðingur - Netlausnir
Sími: 560 5251 - [email protected]
Vátryggingafélag Íslands hf - Ármúla 3 - 108 Reykjavík
http://www.vis.is<http://www.vis.is/> - lagalegur
fyrirvari<http://www.vis.is/disclaimer>
<<inline: vislogo3012.gif>>
------------------------------------------------------------------------------ The modern datacenter depends on network connectivity to access resources and provide services. The best practices for maximizing a physical server's connectivity to a physical network are well understood - see how these rules translate into the virtual world? http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php
