Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jan 21, 2013 9:48 am

Hello,
I need to sign the existing PDF document.
In Help is written about class PdfDocumentBase this: "Represent common properties of PdfNewDocument and PdfLoadedDocument classes."
But Class PdfLoadedDocument doesn't exist in any assembly.

b.ferreira
 
Posts: 1
Joined: Thu Jan 17, 2013 11:13 am

Tue Jan 22, 2013 3:37 am

Hello,

Thanks for your inquiry.
Class PdfDocument can load a exsiting pdf document, but there is no constructor of class PdfSignature can support directly class PdfDocument at present. We are sorry for that. We will add new constructor to support class PdfDocument in the future. Please try the solution below to solve signature problem now. If the solution don't solve your problem after testing, please tell us.
Code: Select all
           PdfDocument doc = new PdfDocument();
            doc.LoadFromFile(@"..\..\sample.pdf");
            PdfCertificate cert = new PdfCertificate(@"..\..\Demo.pfx", "e-iceblue");

            foreach (PdfPageBase page in doc.Pages)
            {
                PdfSignature signature = new PdfSignature(page.Document, page, cert, "demo");
                signature.ContactInfo = "Harry Hu";
                signature.Certificated = true;
                signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill;
            }

            doc.SaveToFile("result.pdf");


Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2767
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF