48 lines
1.2 KiB
VB.net
48 lines
1.2 KiB
VB.net
Imports System.ComponentModel
|
|
Imports DigitalData.Modules.Base
|
|
Imports DigitalData.Modules.Logging
|
|
Imports GdPicture14
|
|
|
|
Public Class Thumbnail
|
|
Inherits BaseClass
|
|
|
|
Dim GDViewer As GdViewer
|
|
|
|
Public Sub New(pLogConfig As LogConfig)
|
|
MyBase.New(pLogConfig)
|
|
|
|
GDViewer = New GdViewer()
|
|
Dim oGDPictureKey As String = MS_GDPICTUREKEY
|
|
|
|
Dim licenseManager As GdPicture14.LicenseManager = New GdPicture14.LicenseManager()
|
|
licenseManager.RegisterKEY(oGDPictureKey)
|
|
|
|
End Sub
|
|
|
|
Public Function GetPageCount(pFilePath As String) As Integer
|
|
Try
|
|
GDViewer.DisplayFromFile(pFilePath)
|
|
|
|
Return GDViewer.PageCount
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Return Nothing
|
|
End Try
|
|
End Function
|
|
|
|
Public Function GetThumbnailFromPDFFile(pFilePath As String) As Bitmap
|
|
Try
|
|
GDViewer.DisplayFromFile(pFilePath)
|
|
Dim thumbnailBitmap As Bitmap = GDViewer.GetPageThumbnailAsBitmap(1000, 1414, 1, Color.White)
|
|
|
|
Return thumbnailBitmap
|
|
|
|
Catch ex As Exception
|
|
Logger.Error(ex)
|
|
Return Nothing
|
|
End Try
|
|
End Function
|
|
|
|
End Class
|