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

can't save pdf file

Dear All

We use this micro for saving PDF file but it bypass the save kindly help me.

----------------------------------------------------------------------------------------------------------

sub ExportToPDF

printExportPDF "D:\Ashish\Dashboard.pdf"
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.Sheets("Sheet1").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.sheets("Sheet1").Print
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.GetApplication.WaitForIdle
'SendMail
end sub
'===========================================================================
Function printExportPDF(pdfOutputFile)
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"
Set WSHShell = nothing
End function
'===========================================================================

Regards

Ashish

2 Replies
Not applicable
Author

help me this issue.

Regards

Ashish

Not applicable
Author

Hi Ashish,

I've tested your script in a simple .qvw and the .pdf file is saved righlty.

Maybe the problem is the printer that you have selected by default, cause in your script you dont say what printeruse to print the Sheet.

This is the script I've tested:

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

sub ExportToPDF
printExportPDF "C:\test.pdf"
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.Sheets("SH01").Activate
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Sleep 2000
ActiveDocument.sheets("SH01").Print
ActiveDocument.GetApplication.Sleep 2000
' ActiveDocument.GetApplication.WaitForIdle
end sub


'===========================================================================
Function printExportPDF(pdfOutputFile)
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\OutputFile", pdfOutputFile, "REG_SZ"
WSHShell.RegWrite "HKCU\Software\QlikViewPDF\BypassSaveAs", "1", "REG_SZ"

Set WSHShell = nothing
End function
'=========================================================================

I hope it helps.