We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Sign PDF Error on Save


I am trying to sign a PDF. I am using your sample code as a starting point.

string inFile = @“c:\temp\TestInput.pdf”;
string outFile = @“c:\temp\TestOutputSigned.pdf”;
Certificate cert = new Certificate(@“c:\temp\MyKey.pfx”, “MyKey”);
PdfFileSignature pdfSign = new PdfFileSignature(cert);
System.Drawing.Rectangle rect = new System.Drawing.Rectangle(100, 100, 200, 100);
pdfSign.SignModel = PdfFileSignature.WINDOWCERTIFICATE;
pdfSign.SignatureAppearance = “”;
pdfSign.CertificationLevel = PdfFileSignature.NOT_CERTIFIED;
pdfSign.Sign(1, “Reason”, “Contact”, “Location”, true, rect);

When the Save method is called I get the following error:

System.ArgumentException: The path is not of a legal form…

System.IO.Path.NormalizePathFast(String path, Boolean fullCheck)
System.IO.Path.NormalizePath(String path, Boolean fullCheck)
System.IO.Path.GetFullPathInternal(String path)
System.IO.FileInfo…ctor(String fileName)
x833cb12bef83f1f9.xa460a0b649265441.xcaa27e5f3b0f9fa3(String xb41a802ca5fde63b)
x833cb12bef83f1f9.xa460a0b649265441.x789d651ae5cebc76(String xb41a802ca5fde63b)
Aspose.Pdf.Kit.PdfFileSignature.Save(Stream outputStream)
Aspose.Pdf.Kit.PdfFileSignature.Save(String outputFile)

Any ideas?


Found the problem. The pdfSign.SignatureAppearance can not be an empty string. Either do not set it, in which case a question mark image is inserted or set it to an image.


Hi Glenn,

Can you please confirm that your issue is resolved? Is there anything we can help you with in this scenario?