Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
We have a report that creates a pdf and then attaches that pdf to an email and sends out. The software has been upgraded (pdf creator v4.1) and now the pdf are empty. Please help if you can. this is critical
Sub printReportPDF(ReportID, ReportName, ReportDirectory)
Dim pdfjob
Dim sPDFName
Dim sPDFPath
sPDFName = ReportName
sPDFPath = ReportDirectory
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
If .cStart("/NoProcessingAtStartup", True) = False Then
Exit Sub
End If
.cVisible = True
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0
.cClearCache
End With
ActiveDocument.PrintReport ReportID, "PDFCreator"
Do Until pdfjob.cCountOfPrintjobs = 1
ActiveDocument.GetApplication.Sleep 20
Loop
pdfjob.cPrinterStop = False
Do Until pdfjob.cCountOfPrintjobs = 0
ActiveDocument.GetApplication.Sleep 20
Loop
pdfjob.cClose
Set pdfjob = Nothing
End Sub
function checkOutputFile(pdfFile)
Set fileTest = CreateObject("Scripting.FileSystemObject")
currentStatus = fileTest.FileExists (pdfFile)
if currentStatus = false then
rem ** let QV sleep for 1 seconds **
ActiveDocument.GetApplication.Sleep 1000
checkOutputFile(pdfFile)
end if
set fileTest = nothing
end function
function activateSaveAs()
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", "", "REG_SZ"
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "0", "REG_SZ"
set WSHShell = nothing
end function
Hi!
Try replacing the line:
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
With this:
Set pdfJob = CreateObject("PDFCreator.JobQueue"): pdfJob.Initialize
@FrankC if the post got you what you needed, please return to the thread and use the Accept as Solution button on the post to mark it as the solution, if that is not it, please leave an update.
Regards,
Brett