Hello,
Thanks for your inquiry.
Kindly note that the multiple-times signing requires the behavior of saving and reloading the document, also applying license is necessary. Below is my testing code, the version I used is
Spire.PDF Pack(Hot Fix) Version:4.8.5. And our sales team just sent a temporary license (one month free) of Spire.PDF to your email. Please apply it (
How to apply the License by license key) and test your case. If there is any question, welcome to write back.
- Code: Select all
//Apply license
Spire.License.LicenseProvider.SetLicenseKey("license key");
//Load pdf
PdfDocument doc = new PdfDocument("sample.pdf");
int num = doc.Pages.Count;
MemoryStream stream = new MemoryStream();
//Sign each page
for (int i = 0; i < num; i++)
{
PdfCertificate digi = new PdfCertificate("gary.pfx", "e-iceblue");
PdfSignature signature = new PdfSignature(doc, doc.Pages[i], digi, "demo");
signature.Bounds = new RectangleF(new PointF(100, 100), new SizeF(500, 200));
signature.DistinguishedName = "DN:";
signature.NameLabel = "Digital Signed By:";
signature.Name = "Ankush";
signature.ContactInfo = "Lisa";
signature.Date = DateTime.Now;
signature.Certificated = false;
signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill | PdfCertificationFlags.ForbidChanges;
//save and reload
doc.SaveToStream(stream);
doc = new PdfDocument(stream);
}
//Save to result pdf
doc.SaveToStream(stream, FileFormat.PDF);
File.WriteAllBytes("result.pdf", stream.ToArray());
Thanks and Regards,
Lisa
E-iceblue support team