Skip to main content

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld 2023, a live, in-person thrill ride. April 17 - 20, 2023, in Las Vegas! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
FrankC
Contributor III
Contributor III

PLEASE HELP

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

Labels (2)
2 Replies
FakeJupiter
Creator
Creator

Hi!

Try replacing the line:
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")

With this:
Set pdfJob = CreateObject("PDFCreator.JobQueue"): pdfJob.Initialize 

Brett_Bleess
Employee
Employee

@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

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.