firma digital-pdf

Vamos haber que sale de aca.....

http://www.ajpdsoft.com/modules.php?name=News&file=article&sid=184

https://aeat.es/facturai.html

http://ciberconta.unizar.es/sic/practicas/factura.htm

http://www.eduardolopez.es/2008/06/01/firma-de-pdf-mediante-la-libreria-itextsharp/

http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=860ee43a-a843-462f-abb5-ff88ea5896f6&displaylang=es

http://www.tbs-certificats.com/fom-serve/cache/316.html

http://xml-utils.com/category/java/page/2/

Solución: hagamos un formulario con este codigo

Para firmar las facturas de clientes o cualquier fichero PDF que elaboro con mi programa "Balances" uso de manera definitiva el fichero descrito en http://www.tbs-certificats.com/fom-serve/cache/316.html y con la versión 2, que encontrareis en http://www.tbs-certificats.com/fom-serve/cache/313.html

La forma de usarlo es siguiendo las indicaciones que detallo más abajo y cuyas dos funciones principales para MS-Access hayareis en http://www.quickpdf.org/forum/forum_posts.asp?TID=437 ( Function SignPdf ) y SyncShell.bas que hayareis en http://aircross.hp.infoseek.co.jp/vb_synshell.htm

Private Sub cmdFirma_Click()

Call SignPdf(CurrentProject.Path & "\fact.pdf", CurrentProject.Path & "\ELQUESEA.pfx", "POREJEMPLO")

End Sub

Public Function SignPdf(FileName As String, Certificat As String, CertificatKey As String) As Boolean

Dim strTemp As String

Dim RepFile As String

RepFile = FileNamePath(FileName)

strTemp = "java -jar " & Chr(34) & CurrentProject.Path & "\TBSSignaturePDF-0.2.jar" & Chr(34) & " "

strTemp = strTemp & "-in " & Chr(34) & FileName & Chr(34) & " "

strTemp = strTemp & "-pkcs12 " & Chr(34) & Certificat & Chr(34) & " "

strTemp = strTemp & "-passwd " & CertificatKey & " "

strTemp = strTemp & "-mode ppkLite "

strTemp = strTemp & "-reason «Certifico la precisión y validez de este documento»"

strTemp = strTemp & "-location «Barcelona»"

On Error Resume Next

Kill RepFile & "signed.pdf"

On Error GoTo 0

SyncShell strTemp, , True

If Dir(RepFile & "signed.pdf") <> "" Then

SignPdf = True

Kill FileName

Name RepFile & "signed.pdf" As FileName

Else

SignPdf = False

End If

End Function

Private Function FileNamePath(FileName As String) As String

'return the path of a file

Dim iPosit As Integer

iPosit = InStrRev(FileName, "\")

If iPosit Then

FileNamePath = Left(FileName, iPosit)

Else

FileNamePath = ""

End If

End Function

en un modulo

'

Attribute VB_Name = "mdlSyncShell"

Option Explicit

Public Const NORMAL_PRIORITY_CLASS = &H20&

Public Const STARTF_USESHOWWINDOW = &H1

Public Const SW_HIDE = 0

Public Const SW_SHOWNORMAL = 1

Public Const SW_SHOWMINIMIZED = 2

Public Const SW_SHOWMAXIMIZED = 3

Public Const SW_SHOWNOACTIVATE = 4

Public Const SW_MINIMIZE = 6

Public Type STARTUPINFO

cb As Long

lpReserved As String

lpDesktop As String

lpTitle As String

dwX As Long

dwY As Long

dwXSize As Long

dwYSize As Long

dwXCountChars As Long

dwYCountChars As Long

dwFillAttribute As Long

dwFlags As Long

wShowWindow As Integer

cbReserved2 As Integer

lpReserved2 As Long

hStdInput As Long

hStdOutput As Long

hStdError As Long

End Type

Public Type PROCESS_INFORMATION

hProcess As Long

hThread As Long

dwProcessID As Long

dwThreadID As Long

End Type

Public Declare Function WaitForSingleObject Lib "kernel32" ( _

ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long

Public Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" ( _

ByVal lpApplicationName As Long, ByVal lpCommandLine As String, _

ByVal lpProcessAttributes As Long, ByVal lpThreadAttributes As Long, _

ByVal bInheritHandles As Long, ByVal dwCreationFlags As Long, _

ByVal lpEnvironment As Long, ByVal lpCurrentDirectory As Long, _

lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long

Public Declare Function CloseHandle Lib "kernel32" _

(ByVal hObject As Long) As Long

Public Declare Function GetExitCodeProcess Lib "kernel32" _

(ByVal hProcess As Long, lpExitCode As Long) As Long

' cmdline 実行するプログラム

' windowstyle 実行するプログラムのウィンドウの形式

' waiting 終了を待機する時間(ms) -1:終了するまで

Public Function SyncShell(ByVal cmdline As String, _

Optional ByVal windowstyle As Long = vbNormalFocus, _

Optional ByVal waiting As Long = -1) As Long

Dim pi As PROCESS_INFORMATION

Dim si As STARTUPINFO

' 実行するプログラムのウィンドウの形式を設定

si.cb = Len(si)

si.dwFlags = STARTF_USESHOWWINDOW

Select Case windowstyle

Case vbHide: si.wShowWindow = SW_HIDE

Case vbMinimizedFocus: si.wShowWindow = SW_SHOWMINIMIZED

Case vbMaximizedFocus: si.wShowWindow = SW_SHOWMAXIMIZED

Case vbNormalNoFocus: si.wShowWindow = SW_SHOWNOACTIVATE

Case vbMinimizedNoFocus: si.wShowWindow = SW_MINIMIZE

Case Else: si.wShowWindow = SW_SHOWNORMAL

End Select

' プログラムを実行

Dim ret As Long

ret = CreateProcess(0, cmdline, 0, 0, 1, NORMAL_PRIORITY_CLASS, 0, 0, si, pi)

' プログラムの終了まで待機

With pi

ret = WaitForSingleObject(.hProcess, waiting)

GetExitCodeProcess .hProcess, ret

CloseHandle .hThread

CloseHandle .hProcess

End With

SyncShell = ret

End Function

Y con ese fichero "TBSSignaturePDF-0.1.jar" , ó este otro "TBSSignaturePDF-0.2.jar" que podras en la web encontrar... yasta, el fichero pdf firmado de manera digital.