Chilkat HOME Android™ Classic ASP C C++ C# Mono C# .NET Core C# C# UWP/WinRT DataFlex Delphi ActiveX Delphi DLL Visual FoxPro Java Lianja MFC Objective-C Perl PHP ActiveX PHP Extension PowerBuilder PowerShell PureBasic CkPython Chilkat2-Python Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ Visual Basic 6.0 VB.NET VB.NET UWP/WinRT VBScript Xojo Plugin Node.js Excel Go
(Excel) Sign PDF for ICP-BrasilSee more PDF Signatures ExamplesSign a PDF to create a signed PDF compliant with the ICP-Brasil Digital Signature Standard Conformity Checker. (Verificador de Conformidade do PadrĂ£o de Assinatura Digital ICP-Brasil) Note: This example requires Chilkat v9.5.0.87 or greater. For more information, see https://verificador.iti.gov.br/verifier-2.6.2/
' This example requires the Chilkat API to have been previously unlocked. ' See Global Unlock Sample for sample code. ' The signed PDF produced by this example should be verifiable at https://verificador.iti.gov.br/verifier-2.6.2/ Dim pdf As Chilkat.Pdf Set pdf = Chilkat.NewPdf ' Load a PDF to be signed. ' The "hello.pdf" is available at https://chilkatsoft.com/hello.pdf success = pdf.LoadFile("qa_data/pdf/hello.pdf") If (success = False) Then Debug.Print pdf.LastErrorText Exit Sub End If Dim json As Chilkat.JsonObject Set json = Chilkat.NewJsonObject ' Define the appearance and location of the signature. Dim success As Boolean success = json.UpdateInt("page",1) success = json.UpdateString("appearance.y","bottom") success = json.UpdateString("appearance.x","middle") success = json.UpdateString("appearance.fontScale","9.0") success = json.UpdateString("appearance.text[0]","Digitally signed by: cert_cn") success = json.UpdateString("appearance.text[1]","current_dt") success = json.UpdateString("appearance.image","document-accepted") success = json.UpdateString("appearance.imagePlacement","left") success = json.UpdateString("appearance.imageOpacity","100") ' Add the CMS options required for ICP-Brasil success = json.UpdateInt("contentType",1) success = json.UpdateInt("messageDigest",1) success = json.UpdateInt("signingCertificateV2",1) success = json.UpdateString("policyId.id","2.16.76.1.7.1.1.2.3") success = json.UpdateString("policyId.hash","sW6Iu/dzIqZ5lbeQeHeO09DqfIhYe29tUYtxXo92o9U=") success = json.UpdateString("policyId.uri","http://politicas.icpbrasil.gov.br/PA_AD_RB_v2_3.der") success = json.UpdateString("policyId.hashAlg","SHA256") ' Load the signing certificate. (Use your own certificate.) ' Note: If loading from a smart card, call LoadFromSmartcard instead, and make sure to use Chilkat v9.5.0.88 or later. Dim cert As Chilkat.Cert Set cert = Chilkat.NewCert success = cert.LoadPfxFile("qa_data/pfx/myPdfSigningCert.pfx","pfx_password") If (success = False) Then Debug.Print cert.LastErrorText Exit Sub End If ' Tell the pdf object to use the certificate for signing. success = pdf.SetSigningCert(cert) If (success = False) Then Debug.Print pdf.LastErrorText Exit Sub End If success = pdf.SignPdf(json,"qa_output/hello_signed.pdf") If (success = False) Then Debug.Print pdf.LastErrorText Exit Sub End If Debug.Print "The PDF has been successfully cryptographically signed." |
© 2000-2022 Chilkat Software, Inc. All Rights Reserved.