After I display pdf, I need to select area on the displayed image and save only selected area as new bmp image. This is the code that I use:
Code: Select all
Public Sub show()
Dim TempFile = System.IO.Path.GetTempPath & Now.Ticks & ".bmp"
Dim npdfID, imageid As Integer
Dim GdPictureImaging As New GdPictureImaging
npdfID = GdViewer1.PdfRenderPageToGdPictureImage(220, GdViewer1.CurrentPage)
Dim LeftArea, TopArea, WidthArea, HeightArea As Integer
If GdViewer1.IsRect Then
Call GdViewer1.GetRectCoordinatesOnDocumentInches(LeftArea, TopArea, WidthArea, HeightArea)
imageid = GdPictureImaging.CreateClonedGdPictureImageArea(npdfID, CInt(LeftArea), CInt(TopArea), CInt(WidthArea), CInt(HeightArea))
GdPictureImaging.SaveAsBMP(imageid, TempFile)
Else
End If
End Sub
What I am doing wrong? Thanks!