Hi,
#fff” title=”" closure_uid_2o2eoz=“296” pc=“A) Funciona correctamente, pasamos el documento de entrada como ruta de fichero.” qc="A) Works fine, we pass the input document as a file path.
“>A) Works fine, we pass the input document as a file path.
<SPAN style=“BACKGROUND-COLOR: #fff” title=”" closure_uid_2o2eoz=“296” pc=“A) Funciona correctamente, pasamos el documento de entrada como ruta de fichero.” qc="A) Works fine, we pass the input document as a file path.">
private byte[] Sign_Document(Pkcs7Signature signature)
{
using (MemoryStream strOutputDoc = new MemoryStream())
{
PdfFileSignature pdfSignature = new PdfFileSignature();
pdfSignature.BindPdf(@"c:\directory\file.pdf");
pdfSignature.Sign(1, "reason", "contact", "location", false, new Rectangle(0, 0, 150, 100), signature);
pdfSignature.Save(strOutputDoc);
return strOutputDoc.ToArray();
}
}
#fff” title=”" closure_uid_2o2eoz=“297” pc=“B) No funciona correctamente, pasamos el documento de entrada como flujo de datos.” qc="B) Not working properly, we as the input document data stream.
">
private byte[] Sign_Document(byte[] document, Pkcs7Signature signature)
{
using (MemoryStream strInputDoc = new MemoryStream(document))
using (MemoryStream strOutputDoc = new MemoryStream())
{
PdfFileSignature pdfSignature = new PdfFileSignature();
pdfSignature.BindPdf(strInputDoc);
pdfSignature.Sign(1, "reason", "contact", "location", false, new Rectangle(0, 0, 150, 100), signature);
pdfSignature.Save(strOutputDoc);
return strOutputDoc.ToArray();
}
}
We need to sign documents in either form A or form B.
Regards,