Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Can't print to PDF

Hi, I've seen many examples for printing reports to PDF. It seams easy but the code doesn't work.

I only need to print one report to PDF and do not have to answer the name neither the path. I'm using that code.


sub printPDF()
tempFolder="c:\TMP"
set rep=ActiveDocument.GetReport("RP01")
reportName=rep.Name
reportFile=tempFolder & reportName & ".pdf"
printReportPDF rep, reportFile
End Sub
function printReportPDF(oReport, 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


It just don't do anything.

Any ideas, thanks.

1 Solution

Accepted Solutions
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you have QlikView PDF Writer installed? It's a separate add-on. If you search this forum, you'll see a download link - I remember someone posted it once.

Oleg

View solution in original post

5 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Do you have QlikView PDF Writer installed? It's a separate add-on. If you search this forum, you'll see a download link - I remember someone posted it once.

Oleg

Not applicable
Author

If I run your code in DEBUG, I get a message "ActiveX component can't create object: 'WScript.Shell'". This is with Macro security set to safe mode.

If I set Macro security to System Access, it runs and creates 2 keys in the registry. I cannot see how it is supposed to print from there - are you missing a few lines?

e.g. ActiveDocument.PrintReport oReport, "QlikViewPDF", false
... put this before

Set WSHShell = nothing

Link to PDF Writer

http://ftp.qliktech.com/QvWebDownloads/Release8/QvPDFSetup.exe

Not applicable
Author

Thank you, I was trying with CutePDF and it didn't work. But once I installed the QlikViewPDF printer it works.

Best regards.

Anonymous
Not applicable
Author

Just a sidenote..

If I recall correctly changing the reg key paths should make it work with CutePDF also. In other words, changing QlikViewPDF to CutePDF.

Not applicable
Author

Jsn, You can do the same with CutePDF, but you need Custom cutepdf to accept the changes in the registry.

Custom Cute pdf is not for free - I think it cost 500$