Signing PDF failed

Error: “The system cannot find the file specified.”


This problem only happens in Production environment: Windows 2008 R2 ASP.NET

static bool Sign2(string input, string output, Stream pfx, string pwd, SignType st, User user, string location)
{
Pkcs1Signature sig = new Pkcs1Signature(pfx, pwd);
if (st == SignType.AuthorSignature)
sig.Reason = “Author Signature”;
else
sig.Reason = “Witness Signature”;
sig.Name = user.FullName;
sig.Contact = user.Email;
sig.Location = location;

if (!File.Exists(input))
throw new Exception("Cannot find input file: " + input);

PdfFileSignature pdfSign = new PdfFileSignature();
pdfSign.BindPdf(input);
pdfSign.Sign(st.ToString(), sig);
using (MemoryStream ms = new MemoryStream())
{
// Failed in this line with Error: “The system cannot find the file specified.”
pdfSign.Save(ms);

File.WriteAllBytes(output, ms.ToArray());
}
return true;
}

Hi,

Thanks for contacting support.

Are you facing this problem with some specific document or its occurring for every document in production environment ?

We apologize for your inconvenience.