"System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
The following sample code seems to generate this error with every pdf I try. Is there a better method for dynimically creating the viewer when you are using it in a windows service where a form is not available. Is there a way to return the page count in the Imaging object?
- Code: Select all
Imports GdPicturePro5
Public Class Sample
Private objGDViewer As Object
Private Sub CountPages()
Try
objGDViewer = CreateObject("gdpicturepro5.GdViewer")
Me.objGDViewer.SetLicenseNumber(strKey)
Me.objGDViewer.SilentMode = True
If File.Exists(strPath) Then
Me.objGDViewer.DisplayFromPDFFile(strPath)
Me.lblPageCount.Text = Me.objGDViewer.PageCount
End If
Finally
If Not IsNothing(objGDViewer) Then
System.Runtime.InteropServices.Marshal.ReleaseComObject(objGDViewer)
End If
End Try
End Sub
End Class
Thanks

