原創|其它|編輯:郝浩|2013-01-17 14:59:27.000|閱讀 340 次
概述:使用activePDF Toolkit除了能實現PDF的轉換功能,還能創建數字簽名,而所有的這一切都只需要通過簡單的代碼設置就可以實現。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
使用activePDF Toolkit除了能實現PDF的轉換功能,還能創建數字簽名,而所有的這一切都只需要通過簡單的代碼設置就可以實現。
示例代碼如下:
// Copyright (c) 2013 activePDF, Inc. // Example created 01/17/13 // Make sure to add the activePDF product .NET DLL(s) to your application. // .NET DLL(s) are typically found in the products 'bin' folder. class Examples { public void main() { long certID; long CreateCertResult; string strPath; int intSignExistingField; strPath = AppDomain.CurrentDomain.BaseDirectory; // Instantiate Object APToolkitNET.Toolkit oTK = new APToolkitNET.Toolkit(); // Find certificate, if it doesn't exist it will be created // If you have an existing signature you can find it with FindCertificate // and remove the portion of code that creates the certificate certID = oTK.FindCertificate("John Doe", "My", 1); if (certID < 1) { // Certificate not found, create a certificate with Toolkit CreateCertResult = oTK.CreateCertificate("John Doe", "Management", "Doe Enterprises", "Mission Viejo", "CA", "US", "john@doee.com", 1, "My", 365, 0, "", ""); if (CreateCertResult == 1) { // New certificate created, find it for use certID = oTK.FindCertificate("John Doe", "My", 1); if (certID < 1) { ErrorHandler("FindCertificate", certID); } } else { // Create certificate failed ErrorHandler("CreateCertificate", CreateCertResult); } } // Sign an existing PDF containing a signature field intSignExistingField = oTK.SignExistingField(certID, strPath + "PDF(sigfield).pdf", strPath + "new.pdf", "SigField", "Mission Viejo, CA", "Security", "949-555-1212", "", 8, "Signed Document", "Helvetica", 12.0f, 1); if (intSignExistingField != 0) { ErrorHandler("SignExistingField", intSignExistingField); } // Release Object oTK = null; // Process Complete System.Diagnostics.Debug.WriteLine("Done!"); } // Error Handling public static void ErrorHandler(string strMethod, object rtnCode) { System.Diagnostics.Debug.WriteLine(strMethod + " error: " + rtnCode.ToString()); } }
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件網