public PDFAttachSignature ( string PDFFile, byte Signature, bool isDisplayErrorsGUI ) : bool | ||
PDFFile | string | |
Signature | byte | |
isDisplayErrorsGUI | bool | |
return | bool |
public bool PDFAttachSignature(string PDFFile, byte[] Signature, bool isDisplayErrorsGUI)
{
if (Signature == null) return false;
try
{
FileStream f = File.OpenWrite(PDFFile);
f.Position = f.Length; //seek to the end of file
f.Write(Signature, 0, Signature.Length); //write the signature content
f.Close();
}
catch (Exception ex)
{
if (isDisplayErrorsGUI)
MessageBox.Show("Error Attaching the signature\n\nException:\n" + ex.Message, "Error");
return false;
}
return true;
}