Frequently Asked Question:
Using Visual Basic and the ActiveX edition of Quick PDF Library
Can you provide some sample code showing how the ActiveX edition of Quick PDF Library can be used with Visual Basic within Visual Studio?
In order to use the ActiveX edition of Quick PDF Library you first need to register it on your machine. To register it simply type the following into the command line (Start > Run > CMD):
regsvr32.exe "C:\Program Files\Quick PDF Library\ActiveX\QuickPDFAX0718.dll"
If necessary, update the path to the ActiveX edition of the library. Once you've received confirmation via a message box that the registration was successfully, you may proceed.
Now that you've registered the ActiveX edition of Quick PDF Library, open Visual Studio with a new or exist solution and add the COM reference for the library by selecting:
Project > Add Reference > COM > Quick PDF Library 7.18
That's all the setting up you need to do -- you're ready to start coding. Here's a short example of how to initiate the library object and perform some basic operations.
Public Class Form1
Private Sub btnHelloWorld_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles btnHelloWorld.Click
Dim ClassName
Dim LicenseKey
ClassName = "QuickPDFAX0718.PDFLibrary"
LicenseKey = "..." //'Insert your trial or commercial license key here
Dim QP
Dim Result
QP = CreateObject(ClassName)
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
QP = Nothing
End Sub
End Class