Page 1 of 1

GDPicture.NET - New Installation problem

Posted: Thu Mar 18, 2010 8:15 pm
by Bobt
Downloaded and installed GDPicture.NET V6.6.05

Using Visual Studio 2008, opened an existing application where I want to add the GDViewer.

Following the "Using GdPicture.NET" section of the documentation I added a reference to GdPicture.NET
Select Project / Add Reference...
Select the Browse tab and select the GdPicture.NET dll library which can be found on C:\Program Files\GdPicture.NET\Redist\Framework X.X\GdPicture.NET.dll
Add a link to the GdPicture namespace where you want to use the DLL
In C#, add the appropriate using directive to the code file(s) where you want to use the DLL: using GdPicture;
In VB.NET, add the appropriate Imports directive to the code file(s) where you want to use the DLL: Imports GdPicture


Then I followed these instructions:

4. Using a GdViewer object into your application.

Before starting, make sure you successfully done first & second steps.

The GdViewer class is a visual class. Therefore you can instantiate a GdViewer object by code or simply dragging a GdViewer item from the Visual Studio Toolbox to your Windows Form:

Right-click into the Toolbox Items and select "Add/Remove Items" for visual studio 2003 or "Choose Items" for Visual Studio 2005 and Visual Studio 2008.
Select the .NET Framework Components tab
Click on the Brows... button
Select the GdPicture.NET dll which can be found on C:\Program Files\GdPicture.NET\Redist\Framework X.X\GdPicture.NET.dll
Now you will be able to select a GdViewer Item from the Toolbox in order to draw it within your forms.


The problem I'm having is that the GdViewer Icon/description in the Toolbox is grayed out. I cannot select it to drag it onto my webform.

Please advise...

Re: GDPicture.NET - New Installation problem

Posted: Fri Mar 19, 2010 9:38 am
by Loïc
Hi,

GdViewer is a Winform control. You can't use a Winform control in a Webform.

With best regards,

Loïc Carrère

Re: GDPicture.NET - New Installation problem

Posted: Fri Mar 19, 2010 4:37 pm
by Bobt
Oh, too bad :(

It wasn't clear from the docs that this was winform only especially since your sample asp.net demo (pdf-ocr) includes it...

Code: Select all

[size=85][i] Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ImageID As Integer

        Dim oGdViewer As New GdPicture.GdViewer
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
        Dim PdfID As Integer

        [color=#FF0000]Dim oGdViewer2 As New GdPicture.GdViewer[/color]

        [color=#FF0000]oGdViewer.SetLicenseNumber[/color]("xxx") 'Please, replace XXXX by a valid demo or commercial license key. Go to http://evaluation-gdpicture.com to get a 1 month trial key unlocking all features of the toolkit.
        oGdPictureImaging.SetLicenseNumber("xxx") 'Please, replace XXXX by a valid demo or commercial license key. Go to http://evaluation-gdpicture.com to get a 1 month trial key unlocking all features of the toolkit.
        oGdPictureImaging.SetLicenseNumberOCRTesseract("xxx") 'Please, replace XXXX by a valid demo or commercial license key. Go to http://evaluation-gdpicture.com to get a 1 month trial key unlocking all features of the toolkit.

        [color=#FF0000]If oGdViewer.DisplayFromFile(Server.MapPath("sample.pdf")) = GdPictureStatus.OK Then[/color]
            PdfID = oGdPictureImaging.PdfOCRStart(Replace(Server.MapPath("sample.pdf"), ".pdf", "_out.pdf"), True, "", "", "", "", "")
            If PdfID <> 0 Then
                For i As Integer = 1 To oGdViewer.PageCount
                    ImageID = oGdViewer.PdfRenderPageToGdPictureImage(200, i)
                    oGdPictureImaging.ConvertTo1Bpp(ImageID)
                    oGdPictureImaging.PdfAddGdPictureImageToPdfOCR(PdfID, ImageID, TesseractDictionary.TesseractDictionaryEnglish, "C:\Program Files\GdPicture.NET\Redist\OCR", "")
                    oGdViewer.ReleaseGdPictureImage(ImageID)
                Next
                oGdPictureImaging.PdfOCRStop(PdfID)
                Label1.Text = "Done! View output: <a href=sample_out.pdf target=_blank>sample_out.pdf</a>"
            Else
                Label1.Text = "Cant Create PDF"
            End If
            oGdViewer.CloseDocument()
        Else
            Label1.Text = "Cant OPEN PDF"
        End If
    End Sub[/i][/size]

Re: GDPicture.NET - New Installation problem

Posted: Fri Mar 19, 2010 5:28 pm
by Loïc
You can use it in server side only (as demonstrated in the asp.net sample).
For client side you need native webcontrols.

With best regards,

Loïc Carrère