by Jose on Fri Jun 01 2007
Hello,
Below is a revised VB.net code that should help you:
Private Sub btnDrawCurrentPage_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDrawCurrentPage.Click
Dim img As Bitmap
acPDFCreatorLib.Initialize()
Dim file1 As System.IO.FileStream = New System.IO.FileStream("c:\temp\image.pdf", IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)
If PdfCreator.Document.Open(file1, "") = True Then
PdfCreator.Document.ZoomFactor = 40
PdfCreator.Document.CurrentPage = PdfCreator.Document.GetPage(1)
img = New Bitmap(200, 250)
Dim c As Graphics = Graphics.FromImage(img)
'//********
'clear color
c.Clear(Color.White)
Dim hdc As IntPtr = c.GetHdc()
PdfCreator.DrawCurrentPage(hdc, True)
file1.Close()
'CleanUp
c.ReleaseHdc(hdc)
img.Save("c:\temp\test.jpg", System.Drawing.Imaging.ImageFormat.Jpeg)
MsgBox("Completed")
Else
MsgBox("Unable to open file")
End If
'This call should only be once when you application
'ends
'acPDFCreatorLib.Terminate()
End Sub