Do you own a Debenu Quick PDF Library 12/11/10/9/8/7? Upgrade to Debenu Quick PDF Library 13!

Foxit Quick PDF Library

Frequently Asked Question:

Return to FAQ Index

Cannot Get An Instance to PDFLibrary Instantiated Using Vb.net (ASP.NET)

Question

I have been pulling out my teeth trying to get this library working and have had no luck.

Here are my specifics:

  • I am running ASP.NET (2.0) using VB.NET as the language of choice
  • I have a dll in my bin folder (QuickPDFDLL0723.dll) and a (QuickPDFDLL0723.vb) class file in my app_code directory.
  • I am trying to convert a PDF to a JPEG so that I can display the first page as the thumbnail

How can I do this using vb.net?

I have tried the following code to no avail:

Public Shared Function BuildThumbnail(ByVal TheFile As String) As Boolean Dim ClassName As String Dim LicenseKey As String

    ClassName = "QuickPDFAX0718.PDFLibrary"
    LicenseKey = "MyKeyHere"


    Dim QP As New QuickPDFDLL0723.PDFLibrary("QuickPDFDLL0723.dll")

    Dim Result As Integer

    Result = QP.UnlockKey(LicenseKey)

    If Result = 1 Then
        QP.LoadFromFile(TheFile)
        QP.RenderPageToFile(204, 1, 5, "mySample.jpg")
        QP.SelectPage(1)
        QP.SetPageThumbnail()
        QP.SaveImageToFile("/EMS Forms/mySample.jpg")

    Else
        Throw New Exception("Invalid license key. Please set a valid license key.")
    End If

    QP = Nothing

End Function

I keep hitting the Invalid license key exception that I programmed in...!!

Can anyone help me with this?

Answer

Your Classname points to an older version of QuickPDF 718

ClassName = "QuickPDFAX0718.PDFLibrary" <--- This could be your problem. Try changing it to 0723.

If that doesn't work then you should check the value of QP itself. Is it null or does it seem to be loading the DLL correctly. I am not familiar with VB and ASP.NET.

You may want to try adding these two functions before you call UnlockKey to see if the DLL is in fact loaded and running correcty.

string s = QP.LibraryVersion();    // Should return 7.23
bool b = QP.LibraryLoaded();       // Should return true

© 2015 Debenu & Foxit. All rights reserved. AboutBuyContactBlogNewsletterSupportFAQProduct UpdatesForum