Code: Select all
Dim cdi As New CDIntfEx.CDIntfEx
Dim strLockName As String
Dim lngAPIResult As Integer
Dim lngLockResult As Long
' attach to existing printer
m_strPDFFileName = App.Path & "\pdf\" & m_lngID & ".pdf"
strLockName = m_strPDFFileName
With cdi
.DriverInit (strChosenPrinter)
.Resolution = 600
lngLockResult = .Lock(strLockName)
If lngLockResult <> 0 Then
WriteToLog ("ERROR: The PDF printer was not locked. Lockname provided was '" & strLockName & "' and the lock result was " & CStr(lngLockResult))
Else
.SetDocFileProps strLockName, NoPrompt + UseFileName, "", m_strPDFFileName
m_blnPrinterInitialized = True
End If
End With