Frequently Asked Question:
Render PDF to device context using Visual Basic 6
I am evaluating Quick PDF Library for use with a custom Visual Basic 6 application we're developing for one of our customers. Would you have any sample VB6 code (using either your ActiveX or DLL versions) that demonstrate how to render a PDF file to a device context or window handle? Any information you can provide would be appreciated.
This example uses DLL version of Quick PDF Library.
You need to add DLL reference and add module "QuickPDFDLL0718.bas" to your VB6 project.
Then use the following code:
Option Explicit
Dim LicenseKey
Dim FileName
Dim Result
Dim InstanceID
Private Sub Form_Load()
// Create QPL instacne
InstanceID = QuickPDFCreateLibrary()
// Enter License Key
LicenseKey = "......LicenceKey......."
// Select Input PDF File
FileName = "C:\input.pdf"
Result = QuickPDFUnlockKey(InstanceID, LicenseKey)
// Load PDF file in memory
Result = QuickPDFLoadFromFile(InstanceID, FileName)
// Render First page of input file to Device Context
Result = QuickPDFRenderPageToDC(InstanceID, 100, 1, hDC)
End Sub