diff --git a/Depurador TSpdfUtils/App.config b/Depurador TSpdfUtils/App.config
new file mode 100644
index 0000000..1c75772
--- /dev/null
+++ b/Depurador TSpdfUtils/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Depurador TSpdfUtils/Depurador TSpdfUtils.vbproj b/Depurador TSpdfUtils/Depurador TSpdfUtils.vbproj
new file mode 100644
index 0000000..61f3ccb
--- /dev/null
+++ b/Depurador TSpdfUtils/Depurador TSpdfUtils.vbproj
@@ -0,0 +1,133 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}
+ WinExe
+ Depurador_TSpdfUtils.My.MyApplication
+ Depurador_TSpdfUtils
+ Depurador TSpdfUtils
+ 512
+ WindowsForms
+ v4.8
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ true
+ true
+ bin\Debug\
+ Depurador TSpdfUtils.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ AnyCPU
+ pdbonly
+ false
+ true
+ true
+ bin\Release\
+ Depurador TSpdfUtils.xml
+ 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
+
+
+ On
+
+
+ Binary
+
+
+ Off
+
+
+ On
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Form
+
+
+ Form1.vb
+ Form
+
+
+
+ True
+ Application.myapp
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+
+
+ Form1.vb
+
+
+ VbMyResourcesResXFileCodeGenerator
+ Resources.Designer.vb
+ My.Resources
+ Designer
+
+
+
+
+ MyApplicationCodeGenerator
+ Application.Designer.vb
+
+
+ SettingsSingleFileGenerator
+ My
+ Settings.Designer.vb
+
+
+
+
+
+ {87114c69-a12b-fade-2c87-d199628c9366}
+ tsPDFUtilsCore
+
+
+ {ebe96c43-7754-94f0-d5a0-52cc0cc95392}
+ TSpdfUtils
+
+
+
+
\ No newline at end of file
diff --git a/Depurador TSpdfUtils/Form1.Designer.vb b/Depurador TSpdfUtils/Form1.Designer.vb
new file mode 100644
index 0000000..eb4b072
--- /dev/null
+++ b/Depurador TSpdfUtils/Form1.Designer.vb
@@ -0,0 +1,50 @@
+ _
+Partial Class Form1
+ Inherits System.Windows.Forms.Form
+
+ 'Form reemplaza a Dispose para limpiar la lista de componentes.
+ _
+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
+ Try
+ If disposing AndAlso components IsNot Nothing Then
+ components.Dispose()
+ End If
+ Finally
+ MyBase.Dispose(disposing)
+ End Try
+ End Sub
+
+ 'Requerido por el Diseñador de Windows Forms
+ Private components As System.ComponentModel.IContainer
+
+ 'NOTA: el Diseñador de Windows Forms necesita el siguiente procedimiento
+ 'Se puede modificar usando el Diseñador de Windows Forms.
+ 'No lo modifique con el editor de código.
+ _
+ Private Sub InitializeComponent()
+ Me.Button1 = New System.Windows.Forms.Button()
+ Me.SuspendLayout()
+ '
+ 'Button1
+ '
+ Me.Button1.Location = New System.Drawing.Point(636, 141)
+ Me.Button1.Name = "Button1"
+ Me.Button1.Size = New System.Drawing.Size(75, 23)
+ Me.Button1.TabIndex = 0
+ Me.Button1.Text = "Button1"
+ Me.Button1.UseVisualStyleBackColor = True
+ '
+ 'Form1
+ '
+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
+ Me.ClientSize = New System.Drawing.Size(800, 450)
+ Me.Controls.Add(Me.Button1)
+ Me.Name = "Form1"
+ Me.Text = "Form1"
+ Me.ResumeLayout(False)
+
+ End Sub
+
+ Friend WithEvents Button1 As Button
+End Class
diff --git a/Depurador TSpdfUtils/Form1.resx b/Depurador TSpdfUtils/Form1.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/Depurador TSpdfUtils/Form1.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Depurador TSpdfUtils/Form1.vb b/Depurador TSpdfUtils/Form1.vb
new file mode 100644
index 0000000..4cdf29c
--- /dev/null
+++ b/Depurador TSpdfUtils/Form1.vb
@@ -0,0 +1,36 @@
+Imports System.IO
+Imports System.Security.Cryptography
+Imports System.Security.Cryptography.X509Certificates
+
+Public Class Form1
+ Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
+ FirmaPDFPFX("prueba", "prueba", "prueba", "c:\tmp\pruebafirmada.pdf", True, True)
+ End Sub
+
+ Public Shared Sub FirmaPDFPFX(Razon As String, Contacto As String, Localizacion As String, FicheroPdfDef As String, EliminaFirmasAnteriores As Boolean, Optional EliminaFicheroDestino As Boolean = False)
+ Dim p As String = "prueba1234."
+ Try
+ Dim bpfx = IO.File.ReadAllBytes("C:\tmp\mmm.pfx")
+ Dim bpdf = IO.File.ReadAllBytes("c:\tmp\E_2026-00322_sellado.pdf")
+ Dim pk As New X509Certificate2(bpfx, p, X509KeyStorageFlags.Exportable)
+ CambiaKeyContainerName(pk)
+ If pk.NotAfter < Now Then Throw New Exception("El certificado está caducado")
+ ' If Not pk.Subject.Contains("CN=" & DocumentoIdentidad) Then Throw New Exception("El certificado no pertenece al validador")
+ Dim ms As New MemoryStream
+ 'tsUtilsPDF.pdf.FirmaPDF(pk, "", PdfStream, ms, Razon, Contacto, Localizacion, RutaTmp, EliminaFirmasAnteriores)
+ TSpdfUtils.Firmas.FirmaPDF(bpfx, p, "", New MemoryStream(bpdf), ms, Razon, Contacto, Localizacion, EliminaFirmasAnteriores)
+ If EliminaFicheroDestino AndAlso IO.File.Exists(FicheroPdfDef) Then IO.File.Delete(FicheroPdfDef)
+ IO.File.WriteAllBytes("c:\tmp\pruebafirmada.pdf", ms.ToArray)
+ Catch ex As Exception
+ Throw New Exception(ex.Message, ex)
+ End Try
+ End Sub
+ Public Shared Sub CambiaKeyContainerName(ByRef Certificado As System.Security.Cryptography.X509Certificates.X509Certificate2)
+ Dim rsa As RSACryptoServiceProvider = CType(Certificado.PrivateKey, RSACryptoServiceProvider)
+ Dim csparams As New CspParameters
+ csparams.KeyContainerName = "TECNOSIS-" & Guid.NewGuid.ToString
+ Dim rsa2 As New RSACryptoServiceProvider(csparams)
+ rsa2.ImportParameters(rsa.ExportParameters(True))
+ Certificado.PrivateKey = rsa2
+ End Sub
+End Class
diff --git a/Depurador TSpdfUtils/My Project/Application.Designer.vb b/Depurador TSpdfUtils/My Project/Application.Designer.vb
new file mode 100644
index 0000000..beec434
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Application.Designer.vb
@@ -0,0 +1,38 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
+ ' or if you encounter build errors in this file, go to the Project Designer
+ ' (go to Project Properties or double-click the My Project node in
+ ' Solution Explorer), and make changes on the Application tab.
+ '
+ Partial Friend Class MyApplication
+
+ _
+ Public Sub New()
+ MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
+ Me.IsSingleInstance = false
+ Me.EnableVisualStyles = true
+ Me.SaveMySettingsOnExit = true
+ Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
+ End Sub
+
+ _
+ Protected Overrides Sub OnCreateMainForm()
+ Me.MainForm = Global.Depurador_TSpdfUtils.Form1
+ End Sub
+ End Class
+End Namespace
diff --git a/Depurador TSpdfUtils/My Project/Application.myapp b/Depurador TSpdfUtils/My Project/Application.myapp
new file mode 100644
index 0000000..1243847
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Application.myapp
@@ -0,0 +1,11 @@
+
+
+ true
+ Form1
+ false
+ 0
+ true
+ 0
+ 0
+ true
+
diff --git a/Depurador TSpdfUtils/My Project/AssemblyInfo.vb b/Depurador TSpdfUtils/My Project/AssemblyInfo.vb
new file mode 100644
index 0000000..825be59
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/AssemblyInfo.vb
@@ -0,0 +1,32 @@
+Imports System
+Imports System.Reflection
+Imports System.Runtime.InteropServices
+
+' La información general de un ensamblado se controla mediante el siguiente
+' conjunto de atributos. Cambie estos valores de atributo para modificar la información
+' asociada con un ensamblado.
+
+' Revisar los valores de los atributos del ensamblado
+
+
+
+
+
+
+
+
+
+
+'El siguiente GUID sirve como id. de typelib si este proyecto se expone a COM.
+
+
+' La información de versión de un ensamblado consta de los cuatro valores siguientes:
+'
+' Versión principal
+' Versión secundaria
+' Número de compilación
+' Revisión
+'
+
+
+
diff --git a/Depurador TSpdfUtils/My Project/Resources.Designer.vb b/Depurador TSpdfUtils/My Project/Resources.Designer.vb
new file mode 100644
index 0000000..7436c80
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Resources.Designer.vb
@@ -0,0 +1,62 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My.Resources
+
+ 'This class was auto-generated by the StronglyTypedResourceBuilder
+ 'class via a tool like ResGen or Visual Studio.
+ 'To add or remove a member, edit your .ResX file then rerun ResGen
+ 'with the /str option, or rebuild your VS project.
+ '''
+ ''' A strongly-typed resource class, for looking up localized strings, etc.
+ '''
+ _
+ Friend Module Resources
+
+ Private resourceMan As Global.System.Resources.ResourceManager
+
+ Private resourceCulture As Global.System.Globalization.CultureInfo
+
+ '''
+ ''' Returns the cached ResourceManager instance used by this class.
+ '''
+ _
+ Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
+ Get
+ If Object.ReferenceEquals(resourceMan, Nothing) Then
+ Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Depurador_TSpdfUtils.Resources", GetType(Resources).Assembly)
+ resourceMan = temp
+ End If
+ Return resourceMan
+ End Get
+ End Property
+
+ '''
+ ''' Overrides the current thread's CurrentUICulture property for all
+ ''' resource lookups using this strongly typed resource class.
+ '''
+ _
+ Friend Property Culture() As Global.System.Globalization.CultureInfo
+ Get
+ Return resourceCulture
+ End Get
+ Set(ByVal value As Global.System.Globalization.CultureInfo)
+ resourceCulture = value
+ End Set
+ End Property
+ End Module
+End Namespace
diff --git a/Depurador TSpdfUtils/My Project/Resources.resx b/Depurador TSpdfUtils/My Project/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Resources.resx
@@ -0,0 +1,117 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Depurador TSpdfUtils/My Project/Settings.Designer.vb b/Depurador TSpdfUtils/My Project/Settings.Designer.vb
new file mode 100644
index 0000000..1fd58d5
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Settings.Designer.vb
@@ -0,0 +1,73 @@
+'------------------------------------------------------------------------------
+'
+' This code was generated by a tool.
+' Runtime Version:4.0.30319.42000
+'
+' Changes to this file may cause incorrect behavior and will be lost if
+' the code is regenerated.
+'
+'------------------------------------------------------------------------------
+
+Option Strict On
+Option Explicit On
+
+
+Namespace My
+
+ _
+ Partial Friend NotInheritable Class MySettings
+ Inherits Global.System.Configuration.ApplicationSettingsBase
+
+ Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
+
+#Region "My.Settings Auto-Save Functionality"
+#If _MyType = "WindowsForms" Then
+ Private Shared addedHandler As Boolean
+
+ Private Shared addedHandlerLockObject As New Object
+
+ _
+ Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ If My.Application.SaveMySettingsOnExit Then
+ My.Settings.Save()
+ End If
+ End Sub
+#End If
+#End Region
+
+ Public Shared ReadOnly Property [Default]() As MySettings
+ Get
+
+#If _MyType = "WindowsForms" Then
+ If Not addedHandler Then
+ SyncLock addedHandlerLockObject
+ If Not addedHandler Then
+ AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
+ addedHandler = True
+ End If
+ End SyncLock
+ End If
+#End If
+ Return defaultInstance
+ End Get
+ End Property
+ End Class
+End Namespace
+
+Namespace My
+
+ _
+ Friend Module MySettingsProperty
+
+ _
+ Friend ReadOnly Property Settings() As Global.Depurador_TSpdfUtils.My.MySettings
+ Get
+ Return Global.Depurador_TSpdfUtils.My.MySettings.Default
+ End Get
+ End Property
+ End Module
+End Namespace
diff --git a/Depurador TSpdfUtils/My Project/Settings.settings b/Depurador TSpdfUtils/My Project/Settings.settings
new file mode 100644
index 0000000..85b890b
--- /dev/null
+++ b/Depurador TSpdfUtils/My Project/Settings.settings
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/TSPdfUtils.sln b/TSPdfUtils.sln
index 9acb2a4..08b844f 100644
--- a/TSPdfUtils.sln
+++ b/TSPdfUtils.sln
@@ -1,12 +1,14 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 17
-VisualStudioVersion = 17.14.36301.6
+# Visual Studio Version 18
+VisualStudioVersion = 18.7.11925.98 stable
MinimumVisualStudioVersion = 10.0.40219.1
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TSpdfUtils", "TSPdfUtils\TSpdfUtils.vbproj", "{EBE96C43-7754-94F0-D5A0-52CC0CC95392}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tsPDFUtilsCore", "tsPDFUtilsCore\tsPDFUtilsCore.csproj", "{87114C69-A12B-FADE-2C87-D199628C9366}"
EndProject
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Depurador TSpdfUtils", "Depurador TSpdfUtils\Depurador TSpdfUtils.vbproj", "{A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{87114C69-A12B-FADE-2C87-D199628C9366}.Debug|Any CPU.Build.0 = Debug|Any CPU
{87114C69-A12B-FADE-2C87-D199628C9366}.Release|Any CPU.ActiveCfg = Release|Any CPU
{87114C69-A12B-FADE-2C87-D199628C9366}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A2F61E77-9FCF-49F2-BDA1-2290D51C2B1C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/TSPdfUtils/Firmas.vb b/TSPdfUtils/Firmas.vb
index 5318523..f34170a 100644
--- a/TSPdfUtils/Firmas.vb
+++ b/TSPdfUtils/Firmas.vb
@@ -278,19 +278,24 @@ Public Class Firmas
reader.SetUnethicalReading(ObviarSeguridad)
End If
-
-
- Dim pdfSign As New PdfSigner(reader, pdfDestino, sp)
+ Dim pdfSign As PdfSigner = Nothing
' EN CASO DE QUE SEA PDFA COMPRUEBA QUE TENGA LA ANOTACIÓN F
- If Utilidades.TieneMarcaPdfA(pdfLectura) Then
- Dim pdfDoc1 As PdfDocument = pdfSign.GetDocument()
- Utilidades.RepararAnotacionesSinF(pdfDoc1)
+
+ If PDFAObligatorio AndAlso ConvertirPDFA Then
+ If Utilidades.TieneMarcaPdfA(pdfLectura) Then
+ Dim pdfDoc1 As PdfDocument = pdfSign.GetDocument()
+ Utilidades.RepararAnotacionesSinF(pdfDoc1)
+ End If
+ pdfSign = New PdfSigner(reader, pdfDestino, sp)
+
+ Else
+ pdfSign = New PdfSigner(reader, pdfDestino, sp, ConvertirPDFA:=False)
End If
- If NombreCampoFirma <> "" Then
+ If NombreCampoFirma <> "" Then
pdfSign.SetFieldName(NombreCampoFirma)
Else
pdfSign.SetFieldName(pdfSign.GetNewSigFieldName())
@@ -336,7 +341,7 @@ Public Class Firmas
reader.Close()
Catch ex As Exception
- Throw New Exception(ex.Message, ex)
+ Throw New Exception("Error en FirmaPDF ConvertirPDFA= " & ConvertirPDFA.ToString & " PDFAObligatorio=" & PDFAObligatorio.ToString & " " & ex.Message, ex)
End Try
End Sub
diff --git a/TSPdfUtils/TSpdfUtils.vbproj b/TSPdfUtils/TSpdfUtils.vbproj
index d5d8a9a..a64569e 100644
--- a/TSPdfUtils/TSpdfUtils.vbproj
+++ b/TSPdfUtils/TSpdfUtils.vbproj
@@ -19,13 +19,14 @@
TSpdfUtils
TSpdfUtils
libreria, netstandard2.0
- 3.0.0.0
- 3.0.0.0
- 3.0.0.0
+ 3.0.4.0
+ 3.0.4.0
+ 3.0.4.0
Manuel
Tecnosis S.A
Utilidades de tratamiento de pdf, de firmas digitales e imagenes.
+ - 3.0.4.0 2026-05-20 Actualización tsPDF
- 3.0.0.0 2026-05-20 Correcciones dependencias Microsoft.Extensions.Logging
- 3.0.0.0 2025-10-23 Actualización de tspdfutilscore
- 1.0.14 2025-10-09 Limpieza de compilados
@@ -57,11 +58,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/tsPDFUtilsCore/tsPDFUtilsCore.csproj b/tsPDFUtilsCore/tsPDFUtilsCore.csproj
index 46bb317..f08a2ac 100644
--- a/tsPDFUtilsCore/tsPDFUtilsCore.csproj
+++ b/tsPDFUtilsCore/tsPDFUtilsCore.csproj
@@ -9,17 +9,18 @@
netstandard2.0;net48
- 3.0.0.0
- 3.0.0.0
+ 3.0.4.0
+ 3.0.4.0
Library
tsPDFUtilsCore
tsPDFUtilsCore
netstandard2.0, libreria
- 3.0.0.0
+ 3.0.4.0
Manuel, Perea
Tecnosis S.A
Utilidades de tratamiento de pdf, de firmas digitales e imagenes.
+ - 3.0.4.0 2026-05-27 Se actualizan dependencias de TSPdf y se separa de la solución también se pasa a git
- 3.0.0.0 2026-05-27 Se actualizan dependencias de TSPdf y se separa de la solución también se pasa a git
- 1.0.13 2026-05-20 Correcciones dependencias Microsoft.Extensions.Logging
- 1.0.12 2025-10-23 se posiciona en 0 la posicion del stream original
@@ -38,9 +39,9 @@
-
-
-
+
+
+