Frequently Asked Question:
Generate PDF report from MS Access application coded in VB
I am working on a MS Access application for our company and we have been testing PDFCreator 0.9.8 to generate PDF files from our report. The problem is that the printer is unstable and works poorly on our Terminal Server. Will this library help us generate a PDF from a report to a certain file location based on code in our VB part of the project?
Yes, you can use Quick PDF Library with Microsoft Access and Visual Basic using either the DLL or ActiveX editions.
Included below is a small example on how to use the ActiveX edition of Quick PDF Library with Microsoft Access and Visual Basic.
Note: you will need to register the ActiveX edition of Quick PDF Library via the command prompt before you proceed.
regsvr32.exe "C:\Program Files\Quick PDF Library\ActiveX\QuickPDFAX0718.dll"
Then you will need to add the ActiveX component that you've just registered as a reference to your Microsoft Access project.
This small snippet of code demonstrates how to initiate the library and access it's functions.
Private Sub Command2_Click()
Dim ClassName
Dim LicenseKey
Dim FileName
ClassName = "QuickPDFAX0718.PDFLibrary"
LicenseKey = "..."
FileName = "1.hello-world.pdf"
Dim QP
Dim Result
Set QP = CreateObject(ClassName)
MsgBox ("Library version: " + QP.LibraryVersion)
Result = QP.UnlockKey(LicenseKey)
If Result = 1 Then
MsgBox ("Valid license key: " + QP.LicenseInfo)
Call QP.DrawText(100, 500, "Hello world from MS Access")
If QP.SaveToFile(FileName) = 1 Then
MsgBox ("File " + FileName + " written successfully")
Else
MsgBox ("Error, file could not be written")
End If
Else
MsgBox ("- Invalid license key -")
MsgBox ("Please set your license key by editing this file")
End If
Set QP = Nothing
End Sub