Loading...

Using GDViewer in Windows Service

Support for GdViewer OCX and GdViewer Pro ActiveX/SDK.

Using GDViewer in Windows Service

Postby jstark » Thu Feb 19, 2009 7:10 pm

I am having a problem with GDViewer. I am getting the following exception:

"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
jstark
 
Posts: 17
Joined: Wed Apr 02, 2008 5:53 pm

Re: Using GDViewer in Windows Service

Postby jstark » Wed Feb 25, 2009 1:10 am

HELP
jstark
 
Posts: 17
Joined: Wed Apr 02, 2008 5:53 pm

Re: Using GDViewer in Windows Service

Postby Loïc » Wed Feb 25, 2009 5:22 pm

Hi,

I can't reproduce the problem, I need more details.

Please, send me a tiny application raising the error at esupport (at) gdpicture (dot) com.

Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4441
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Using GDViewer in Windows Service

Postby dcreeron » Sat May 30, 2009 3:18 am

Looking at your code it appears your aren't closing the image that you've loaded in the viewer.

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
                     ' *******
                     Me.objGDViewer.CloseImage()  ' Close the image you've loaded
                     ' *******
               End If
          Finally
               If Not IsNothing(objGDViewer) Then
                   System.Runtime.InteropServices.Marshal.ReleaseComObject(objGDViewer)
               End If
          End Try
     End Sub
End Class


Try adding a call to CloseImage, that should solve the issue.
Daniel Creeron
Image
http://www.chocksettsoftware.com
Home of Paper Valet and Paper Valet Pro
<Sarcasm msg='Love that Paper Scan is very similar to my product!' />
dcreeron
 
Posts: 35
Joined: Tue Apr 14, 2009 7:55 pm
Location: Apex, NC


Return to GdViewer [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest