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
suniljain
Master
Master

Dear Chakravarthy,

Can you share logic ?.

Regards;

Sunil

Not applicable
Author

Hi fishs,

I tried the code u have shared over here. (the one in Correct answer)

But i want to save the pdf automatically. Save as dialog should not appear. This is not working..

Can u please explain how can i achieve that?

Not applicable
Author

Hi Fishs,

sub ReportCheck

set var = ActiveDocument.Variables("vCreatePDF")

val = var.GetContent.String

if val = 1 then

call CreateReports

var.SetContent 0, true

end if

End Sub

This Sub does not work for me.

It gives me error on "val = var.GetContent.String"

asObject required: 'var'

Please can you tell me what is wrong?