Print Page | Close Window

Setting up visual studio

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2423
Printed Date: 17 Jan 26 at 3:36PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Setting up visual studio
Posted By: dptulk
Subject: Setting up visual studio
Date Posted: 02 Oct 12 at 10:26PM
I have one project that is working with QuickPDF without issue.  When i go to create another It seems to fail and i I cannot seem to figure out why.
I have imported the: QuickPDFDLL0813.dll and QuickPDFDLL0813.vb files into the project.   
Set the Imports: Imports BLINK_DOC_MANAGMENT.QuickPDFDLL0813
Then I run the following and it says "invalid licence key"
       Dim QP As PDFLibrary
        Dim LicenseKey
        Dim Result
        QP = New PDFLibrary("QuickPDFDLL0813.dll")
        LicenseKey = "je5e3798XXXXXXXXXXXXXpb6y"
        Result = QP.UnlockKey(LicenseKey)
        If Result = 1 Then
            QP.SetOrigin(1)
            QP.DrawText(100, 100, "Hello Visual Basic! This text has been drawn using the DrawText function.")
            QP.SaveToFile("Hello_World.pdf")
        Else
            MsgBox("- Invalid license key -")
        End If
Is there something else that I have missed?



Replies:
Posted By: darkv
Date Posted: 02 Oct 12 at 11:58PM
Hello dptulk,

a dim state without type create an object or a variant, which could not be terminated by the right character for a string.

did you try to prototype the key as string?
which VS are you using?

Rgds


-------------
z Dark side is there ...


Posted By: dptulk
Date Posted: 04 Oct 12 at 3:42PM
I set the key as a string and it still does not work.  I am using VS 2010 Pro.

This just doesn't make any sense.  My other project works just fine but I have tried several others and none of them will work.


Posted By: dptulk
Date Posted: 04 Oct 12 at 3:51PM
Here is the current version.  I hope that someone has some insight into this:

Imports QuickPDFBase.QuickPDFDLL0813
Imports System.IO

Public Class QuickPDFTest

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        Dim QP As PDFLibrary
        Dim LicenseKey As String
        Dim Result As Boolean

        QP = New PDFLibrary("QuickPDFDLL0813.dll")
        LicenseKey = "XXXXXXXXXXXXXXXXXXXXX"

        Result = QP.UnlockKey(LicenseKey)
        If Result = 1 Then
            QP.SetOrigin(1)
            QP.DrawText(100, 100, "Hello Visual Basic! This text has been drawn using the DrawText function.")
            QP.SaveToFile("Hello_World.pdf")
        Else
            MsgBox("sh*t!")
        End If



    End Sub
End Class


Posted By: darkv
Date Posted: 04 Oct 12 at 6:59PM
It's roughly the same code i used with few differences

+ result is an integer or a long not a boolean
+ i'm using 7.x version of the dll
+ when i call the new library, i point directly to the full dll path to avoid misinterpretation by he compiler

Rgds




-------------
z Dark side is there ...


Posted By: AndrewC
Date Posted: 05 Oct 12 at 3:23AM
You may need to set your Platform Target to x86 to force it to create a 32 bit EXE.  If it is currently set to Any CPU then it could be creating a 64 bit EXE which is then failing to load the 32 bit DLL.

You could run a quick test by changing the code to the following

QP = New PDFLibrary("QuickPDF64DLL0813.dll")

You would need to make sure the 64 bit DLL is in the same directory as your EXE file.

The next step could be add the following so that it can run either 32 or 64 bit mode automatically.

if (IntPtr.Size == 4)
QP = New PDFLibrary("QuickPDFDLL0813.dll")
else
QP = New PDFLibrary("QuickPDF64DLL0813.dll")



Posted By: dptulk
Date Posted: 06 Oct 12 at 2:14PM
Thanks Andrew.  It was not the 64 bit issue.  Not sure what it was really.  I ended up creating an empty project and getting it to work and then moving all of my code from my other one into the new one.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk