iTextsharp modify a signed file
I am developer and I have a problem with PDF signed. I received a PDF file, created with Life Cycle (I don´t know if it is xfa or hybrid, because the form come from the Federal Tax Agency) that already contain two digital signing over some acroFields. I have to put a couple of data over other acrofields, and I´m using iTextsharp code.:The problem is the new file has the two previous signing broken. I don´t know what is wrong. Thanks in advance
My code is:
PdfReader pdfReader = null;
PdfStamper stamper = null;
string filePDF = @"C:\Visual Studio Solutions\Visual Windows\cpce Certificaciones\prueba_xfa.pdf";
string outPDF = @"C:\Visual Studio Solutions\Visual Windows\cpce Certificaciones\prueba_xfa_out.pdf";
try
{
using (var inStream = new FileStream(filePDF, FileMode.Open))
{
pdfReader = new PdfReader(inStream);
}
using (var outStream = new FileStream(outPDF, FileMode.Create))
{
stamper = new PdfStamper(pdfReader, outStream, '\0', true);
var form = stamper.AcroFields;
form.SetField("FORMULARIO[0].SUBFORMULARIO[0].ConsejoSubForm[0].OBLEA[0]", "probando");
stamper.Close();
pdfReader.Close();
}
}
catch (Exception ex)
{
throw new Exception("error: " + ex.Message);
}
