Creating GDViewer object in code

Discussions about document viewing.
Post Reply
mp33487
Posts: 54
Joined: Wed May 06, 2009 4:26 am

Creating GDViewer object in code

Post by mp33487 » Wed May 06, 2009 4:12 pm

When I try and create the GDViewer object like below I get an error...

I get an error when I try...
Dim GDViewer as New GDViewer

But this works without issue for the imaging object...
Dim oImaging As New GdPictureImaging

In the demo, this worked... However, this is not the .NET version I am licensed for so I get a licensing error.
Dim oGdViewer As GdViewer = CType(CreateObject("GdViewer"), GdPicturePro5.GdViewer)

Can you tell me how to create the object so I can use the viewer and imaging object in code w/o having it on the form. I need to process image files and do cleanup, etc., to them. Thanks in advance.
MP

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Wed May 06, 2009 6:39 pm

Hi,

Code: Select all

 Dim GdViewer1 As New GdPicture.GdViewer

mp33487
Posts: 54
Joined: Wed May 06, 2009 4:26 am

Re: Creating GDViewer object in code

Post by mp33487 » Fri May 08, 2009 5:51 pm

I tried...

Dim oGdViewer As New GdPicture.GdViewer

and I get the error "DragDrop registartion did not succeed."

Any ideas?

mp33487
Posts: 54
Joined: Wed May 06, 2009 4:26 am

Re: Creating GDViewer object in code

Post by mp33487 » Sun May 10, 2009 4:14 pm

Still waiting for response,,,I need this ASAP to work. I'm going to loose this project!!

EDIT by Loïc Carrère -> it's normal, it's Sunday...

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Sun May 10, 2009 4:20 pm

Hi,

I can't reproduce your problem.

- I downloaded the lat GdPicture.NET package
- I opened a vb.net sample IE: C:\Program Files\GdPicture.NET\samples\vb.net\Image Processing\Image Processing.vbprog
- I added a button and the following code:

Code: Select all

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ooGdViewer As New GdPicture.GdViewer

        ooGdViewer.SetLicenseNumber("XXX")
        ooGdViewer.DisplayFromFile("")
    End Sub
And all is working perfectly.

If you are able to give me a way to reproduce your error I will be able to help you more.

Kind regards,

Loïc

mp33487
Posts: 54
Joined: Wed May 06, 2009 4:26 am

Re: Creating GDViewer object in code

Post by mp33487 » Mon May 11, 2009 11:30 pm

I found that this is caused by me running my code in a thread. If I run it withouth the thread then I don't get the error when I create the object. I'm using the thread because I was having issued with the interface refreshing while processing files. V5 of this SDK (that's what I eval'ed) didn't have this issue and worked fine. Can you advise?

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Tue May 12, 2009 10:19 am

Hi,

There is a lot of articles related to this issue which can be found with google. Maybe this can help you: http://www.google.com/#hl=en&safe=off&e ... XZkQW-twqo

Loïc

bbanet
Posts: 17
Joined: Mon Jun 15, 2009 11:03 pm

Re: Creating GDViewer object in code

Post by bbanet » Mon Jun 15, 2009 11:05 pm

Did you have any luck with a resolution? I am seeing the same D&D registration error. I am sure it has something to do with there being no form. I am trying to create the view object in memory without ever displaying it.

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Tue Jun 16, 2009 10:37 am

Hi,

are you able to create a simple & standalone application which reproduce your problem ?

Kind regards,

Loïc

Sly
Posts: 15
Joined: Sun Dec 30, 2007 2:16 pm

Re: Creating GDViewer object in code

Post by Sly » Mon Jul 06, 2009 12:05 pm

We are encountering the same problem. It is giving us a "draganddropregistration" error. You can easly recreate the problem with a class library project. Let's assume you want to put up a server that has to work with both Imaging object and viewer object (at least to render pdf pages to imageviewer and then convert to something), you do this creating a class library (with or without a windows form containing the viewer) and as result you have:

1) Imaging object is always working;
2) viewer never works (you get an error at initialization time).

EG:

Code: Select all

            GdPictureImaging imgMgr;
            imgMgr = new GdPictureImaging(); //works fine

            GdViewer doc; 
            doc = new GdViewer(); // crashes
            doc.SilentMode = true; 
Any clue???????


RED_GROUP::Mau

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Mon Jul 06, 2009 12:06 pm

Hi,

Again we were unable to reproduce this problem. We need a sample application.

Kind regards,

Loïc

Sly
Posts: 15
Joined: Sun Dec 30, 2007 2:16 pm

Re: Creating GDViewer object in code

Post by Sly » Mon Jul 06, 2009 1:11 pm

Sorry,

if you create a class library project, you will not have the drag&drop error message. Our scenario is much more complicated.
We have a class library that implements a remote server (using dot net remoting architecture). Then a client invokes a server method that uses GdViewer.
Then we encounter the error of the previous post.
I suppose the problem is in MTA or STA Thread. The error detail suggests us to use the [STAThread] tag, but we get the same error.

Any idea?

RED_GROUP::Mau

Sly
Posts: 15
Joined: Sun Dec 30, 2007 2:16 pm

Re: Creating GDViewer object in code

Post by Sly » Mon Jul 06, 2009 3:02 pm

We can bypass the problem using GdPictureImaging instead of GdViewer.
We have to extract a single page from a pdf file. This is the code we used for this purpose, can you tell us how to obtain the same thing (if it is possible) using GdPictureImaging?

Code: Select all

                       if (doc.DisplayFromFile(file) == GdPictureStatus.OK)
                        {
                            for (i = startIndexPage; i <= endIndexPage; i++)
                            {
                                pageID = doc.PdfRenderPageToGdPictureImage(Convert.ToInt32(doc.HorizontalResolution), i);
                                ret[j] = imgMgr.SaveAsString(pageID, DocumentFormat.DocumentFormatPDF, 0);
                                j += 1;
                            }
                        }
                        doc.Clear();
Thanks in advance,

RED_GROUP::Mau

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Creating GDViewer object in code

Post by Loïc » Mon Jul 06, 2009 3:45 pm

Hi,

Unfortunately, handling existing PDF from the GdPictureImaging class is not yet available. This feature will be the major evolution of GdPicture.NET 6.5 editions.

With best regards,

Loïc

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest