3.0.7.0 2026-05-20 Se elimina PdfSignatureTools, Nuevo metodo ObtenerPropiedadDePdf

This commit is contained in:
2026-09-02 16:02:35 +02:00
parent e07c24d325
commit 25b72a0223
4 changed files with 853 additions and 4 deletions

View File

@@ -691,7 +691,51 @@ Public Class pdf
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function ObtenerPropiedadDePdf(
FicheroPdf As MemoryStream,
NombrePropiedad As String) As String
Try
If FicheroPdf Is Nothing Then
Throw New ArgumentNullException(NameOf(FicheroPdf))
End If
If FicheroPdf.CanSeek Then
FicheroPdf.Position = 0
End If
Using reader As New PdfReader(FicheroPdf)
Using pdfDocument As New PdfDocument(reader)
Dim info As PdfDictionary =
pdfDocument.GetTrailer().GetAsDictionary(PdfName.Info)
If info Is Nothing Then
Return Nothing
End If
Dim valor As PdfString =
info.GetAsString(New PdfName(NombrePropiedad))
If valor Is Nothing Then
Return Nothing
End If
Return valor.ToUnicodeString()
End Using
End Using
Catch ex As Exception
Throw New Exception(
"Error obteniendo la propiedad '" &
NombrePropiedad &
"': " &
ex.Message,
ex)
End Try
End Function
Public Shared Function ExtractTextFromPDF(ByVal RutaPdf As String) As String
Dim pdfReader As PdfReader = New PdfReader(RutaPdf)
Dim pdfDoc As PdfDocument = New PdfDocument(pdfReader)