Interfaces: More logging for PDFEmbeds.Extract

This commit is contained in:
Jonathan Jenne 2021-07-09 12:45:23 +02:00
parent 9004b3db88
commit 33b83a1f6c

View File

@ -25,10 +25,22 @@ Public Class PDFEmbeds
''' <param name="AllowedExtensions">List of allowed extensions to be extracted</param> ''' <param name="AllowedExtensions">List of allowed extensions to be extracted</param>
Public Function Extract(FilePath As String, AllowedExtensions As List(Of String)) As List(Of EmbeddedFile) Public Function Extract(FilePath As String, AllowedExtensions As List(Of String)) As List(Of EmbeddedFile)
Dim oFile As New List(Of EmbeddedFile) Dim oFile As New List(Of EmbeddedFile)
Dim oFileInfo As FileInfo
Dim oExtensions = AllowedExtensions.ConvertAll(New Converter(Of String, String)(Function(ext) ext.ToUpper)) Dim oExtensions = AllowedExtensions.ConvertAll(New Converter(Of String, String)(Function(ext) ext.ToUpper))
Logger.Debug("Extracting embedded files from [{0}]", FilePath) Logger.Debug("Extracting embedded files from [{0}]", FilePath)
Try
oFileInfo = New FileInfo(FilePath)
Logger.Debug("Filename: {0}", oFileInfo.Name)
Logger.Debug("Filesize: {0}", oFileInfo.Length)
Logger.Debug("Exists: {0}", oFileInfo.Exists)
Catch ex As Exception
Logger.Warn("File information for [{0}] could not be read!", FilePath)
Logger.Error(ex)
End Try
Try Try
Using oGDPicturePDF As New GdPicturePDF() Using oGDPicturePDF As New GdPicturePDF()
If oGDPicturePDF.LoadFromFile(FilePath, False) = GdPictureStatus.OK Then If oGDPicturePDF.LoadFromFile(FilePath, False) = GdPictureStatus.OK Then