public static void VerifyPDFSigned()
        {
            // ExStart:VerifyPDFSigned               
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_SecuritySignatures();

            PdfFileSignature pdfSign = new PdfFileSignature();
            pdfSign.BindPdf(dataDir + "DigitallySign.pdf");
            pdfSign.ContainsSignature();
            // Any signatures?
            pdfSign.Close();
            // ExEnd:VerifyPDFSigned  
        }
예제 #2
0
        public static void VerifyPDFSigned()
        {
            // ExStart:VerifyPDFSigned
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_SecuritySignatures();

            PdfFileSignature pdfSign = new PdfFileSignature();

            pdfSign.BindPdf(dataDir + "DigitallySign.pdf");
            pdfSign.ContainsSignature();
            // Any signatures?
            pdfSign.Close();
            // ExEnd:VerifyPDFSigned
        }
 public static void VerifySignatures()
 {
     // ExStart:VerifySignatures
     // The path to the documents directory.
     string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();
     // Create PdfFileSignature object
     PdfFileSignature pdfVerify = new PdfFileSignature();
     // Bind input PDF file
     pdfVerify.BindPdf(dataDir + "inFile.pdf");
     // Check if PDF contains signature
     bool isSigned = pdfVerify.ContainsSignature();
     // All signatures have names Signaure#, this names kit generates automatically
     bool isSignatureVerified = pdfVerify.VerifySignature("Signature1");
     // However we can set necessary name manualy if we use signature fields (see below)
     bool isSignatureVerified2 = pdfVerify.VerifySignature("Signature from Alice");
     // ExEnd:VerifySignatures
 }
        public static void VerifySignatures()
        {
            // ExStart:VerifySignatures
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();
            // Create PdfFileSignature object
            PdfFileSignature pdfVerify = new PdfFileSignature();

            // Bind input PDF file
            pdfVerify.BindPdf(dataDir + "inFile.pdf");
            // Check if PDF contains signature
            bool isSigned = pdfVerify.ContainsSignature();
            // All signatures have names Signaure#, this names kit generates automatically
            bool isSignatureVerified = pdfVerify.VerifySignature("Signature1");
            // However we can set necessary name manualy if we use signature fields (see below)
            bool isSignatureVerified2 = pdfVerify.VerifySignature("Signature from Alice");
            // ExEnd:VerifySignatures
        }
 public static void Run()
 {
     try
     {
         // ExStart:ExtractImages               
         // The path to the documents directory.
         string dataDir = RunExamples.GetDataDir_AsposePdfFacades_SecuritySignatures();
         string input = dataDir + "DigitallySign.pdf";
         Document doc = new Document(input);
         using (PdfFileSignature signature = new PdfFileSignature(doc))
         {
             if (signature.ContainsSignature())
             {
                 foreach (string sigName in signature.GetSignNames())
                 {
                     string outFile = dataDir + "ExtractImages_out.jpg";
                     using (Stream imageStream = signature.ExtractImage(sigName))
                     {
                         if (imageStream != null)
                         {
                             using (System.Drawing.Image image = Bitmap.FromStream(imageStream))
                             {
                                 image.Save(outFile, ImageFormat.Jpeg);
                             }
                         }
                     }
                 }
             }
         }
         // ExEnd:ExtractImages
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }       
 public static void Run()
 {
     try
     {
         // ExStart:ExtractImages
         // The path to the documents directory.
         string   dataDir = RunExamples.GetDataDir_AsposePdfFacades_SecuritySignatures();
         string   input   = dataDir + "DigitallySign.pdf";
         Document doc     = new Document(input);
         using (PdfFileSignature signature = new PdfFileSignature(doc))
         {
             if (signature.ContainsSignature())
             {
                 foreach (string sigName in signature.GetSignNames())
                 {
                     string outFile = dataDir + "ExtractImages_out.jpg";
                     using (Stream imageStream = signature.ExtractImage(sigName))
                     {
                         if (imageStream != null)
                         {
                             using (System.Drawing.Image image = Bitmap.FromStream(imageStream))
                             {
                                 image.Save(outFile, ImageFormat.Jpeg);
                             }
                         }
                     }
                 }
             }
         }
         // ExEnd:ExtractImages
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }