Private Sub ConvertPDFToImage(ByVal strFileName As String)
Dim f As New SautinSoft.PdfFocus()
f.OpenPdf(strFileName)
If f.PageCount > 0 Then
f.ImageOptions.Dpi = 200
f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
For page As Integer = 1 To f.PageCount
f.ToImage("D:\KIMBALL ELECTRONIC\IT\C\picture" & "page" & page & ".jpg", page)
Next
End If
End Sub
Private Shared Sub Main(ByVal args As String())
Dim di As New IO.DirectoryInfo("D:\KIMBALL ELECTRONIC\IT\C\")
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
For Each dra In diar1
ConvertPDFToImage(dra) 'ตรงนี้มันไม่รู้ค่าอะคะ
Next
End Sub
error ConvertPDFToImage(dra) >> Cannot refer to an instance member of a class from within a shared method or shared member initializer without an explicit instance of the class
Private Sub ConvertPDFToImage(ByVal strFileName As String)
Dim f As New SautinSoft.PdfFocus()
f.OpenPdf(strFileName)
If f.PageCount > 0 Then
f.ImageOptions.Dpi = 200
f.ImageOptions.ImageFormat = System.Drawing.Imaging.ImageFormat.Jpeg
For page As Integer = 1 To f.PageCount
f.ToImage("D:\KIMBALL ELECTRONIC\IT\C\picture" & "page" & page & ".jpg", page)
Next
End If
End Sub
Private Sub Main(ByVal args As String())
Dim di As New IO.DirectoryInfo("D:\KIMBALL ELECTRONIC\IT\C\")
Dim diar1 As IO.FileInfo() = di.GetFiles()
Dim dra As IO.FileInfo
For Each dra In diar1
Call ConvertPDFToImage(dra.ToString)
Next
End Sub