Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

OnPostReload macro create PDF does not work

Hi All

I have a macro to print pdf's with a trigger OnPostReload that works ok when the QlikView document is reloaded directly via the desktop but when my document is reloaded via the server it does not create the pdf?. Does anyone have any ideas or suggestions. Using 9 sr5, QlikViewPDF, have set Requested Module Security to System Access and Current Local Security to Allow System Access.

'***************************************************

'Functions creates the reports in PDF format

'***************************************************

sub CreateReports

"D:\DataPDF"

"RP01"

set rep = ActiveDocument.GetReport(reportID)

set vShow = ActiveDocument.Variables("vShow")

"on", true

'Create the file name with path

"" & reportID & "_" & reportName & ".pdf"

'print the report

'Call the function

'Rename the report

'checkOutputFile reportFile, tempFolder 'Call the function

'call ClearDefault() 'Call the function

end sub

'***************************************************

'Actual function to print the PDF format without being asked for location to save

'***************************************************

function printReportPDF(oReport, pdfLocation)

Set WSHShell = CreateObject("WScript.Shell")

"HKCU\Software\CUSTPDF Writer\DefaultLocation", pdfLocation, "REG_SZ"

"HKCU\Software\CUSTPDF Writer\UseJobName", "1", "REG_SZ"

"HKCU\Software\CUSTPDF Writer\UseDefaultLocation", "1", "REG_SZ"

'QV Print

"QlikViewPDF",false

set WSHShell = nothing

end function

Many thanks

Steve.

22 Replies
Not applicable
Author

It depends on where you are trying to load the QV.exe program from. If it is your C: drive on your PC, then yes. Otherwise the location that you are loading the QV.exe from must have it installed there.

Not applicable
Author

Hello,

I'm having doubts. When I run this macro createreports pdfcretor opening prompt. How can I not open this window?

Not applicable
Author

Hi Steve,

Have you got the solution .. Please let me know ....

Regards,

Chakravarthy.

Not applicable
Author

redid the app and it is not opening the window more createpdf, but not the fileis being saved in the directory, anyone know what might be?
thanks...


Not applicable
Author

Hi Robson/Chakravarthy - It would be a lot easier if you could upload your doc. You could limit your data so as not to give away any real information...

Not applicable
Author

Hi Steve,

Sorry, I need this in pdf and automatically generate...

thanks

Not applicable
Author

Hi, I´m testing this command line but I have a problem, the aplicattion reload perfect, but when it has to generate the pdf the status is SPOOLING so it doesn´t generate it.

My command line is this: execute "C:\Program Files\QlikView\QV.exe" /R /vvCreatePDF=1 /NoSecurity E:\Produccion\QlikViewStorage\Admisiones\Aplicaciones\Admisiones_Reporte.qvw

if I reload inside the application it generates the pdf perfectly, i don't know why is failing.

Any ideas???

Not applicable
Author

Hi Matytr21

I may be wrong as it was a awhile ago, but when I did this I think I had a problem with reloading and creating the PDF in one command. What I can tell you is that I reload the document through management console and then when I run my script it is only to generate the PDF i.e. with the command to execute the variable (/vvCreatePDF=1) and it works... So my *.bat file has the following call "C:\Program Files\QlikView\Qv.exe" /NoSecurity /vvCreatePDF=1 "D:\QVApps\Prod\Sales\Group EMEA.qvw" so no /R.

Not applicable
Author

Hi Robson

I opened your test doc and when I clicked the "Test" button it did not work, but gave the Current Local Security - Allow System Access and then it worked fine. It will automatically print the PDF to my local printer. It printed the 2 possible values of 10 and 50. If your question it to now do this on a schedule you need to create a *.bat file (call "C:\Program Files\QlikView\Qv.exe" /NoSecurity /vvCreatePDF=1 "D:\QVApps\Prod\Sales\Group EMEA.qvw") replacing my route and file name with yours. The second thing is in Settings - Document Properties - Triggers - OnOpen, add a action - Run Macro "Report Check". Then add this code to your module. Hope this helps and answers your question?

sub ReportCheck

set var = ActiveDocument.Variables("vCreatePDF")

val = var.GetContent.String

if val = 1 then

var.SetContent 0, true

call CreateReports

ActiveDocument.GetApplication.Quit

end if

End Sub

Not applicable
Author

Hi Steve,

Thanks for the help. My mistake was in setting PDFCreator I had not configuredto automatically print and did not know how to configure a trigger, but with yourhelp I managed to set the trigger.

Thanks! Beer