Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

Not applicable

Macro to create PDF

Hi,

I have gone through the interesting discussion " Macro to export AND mail report as PDF"  by different authors in the discussion started by in October 2010 by JochenAndries  (using Bullzip PDF). Em Vau suggested in Februaru 2012 to use QlikViewPDF. Thanks to both and others contributed on the same discussion. Excellent automation tips!

I have used QlikVewPDF.  I have combined sub code and function code for simplicity. The code works fine but  QlikViewPDF printer dialogue opens, which should not. The PDF file should be saved automatically.

I am attaching  image of code, image of  saveas dialog and the QVW document.

                                                  

Kindly suggest how we can avoid the SaveAs dialog.

Regards,

KSP

Code
Image1.png
Image2.png


21 Replies
Not applicable

Re: Macro to create PDF

I use PDF-XChange and the method should work in your case as well. Open 'Devices and Printers' in the windows Start menu. Look for QlikViewPdf in Printers and Faxes section. Right-click on the icon and select 'Printing Preferences'. Scan through the sections and you should find a place to change the 'Save' preferences. For example, in PDF-XChange, it is in 'Save' section.

omid5ive
Not applicable

Re: Macro to create PDF

hi kspalani

you can use this code for printing pdf with qlikview PDF

sub printRP01

printReportPDF "C:\Temp\18T.pdf"

ActiveDocument.GetApplication.Sleep 2000

ActiveDocument.PrintReport "RP02", "QlikViewPDF"

ActiveDocument.GetApplication.Sleep 10000

end sub

'===========================================================================

Function printReportPDF(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

Not applicable

Re: Macro to create PDF

Hi Omid Ebrahimi

Still I get SaveAs dialog. I wish to avoid it and save directly without user intervention,

If you can guide, it would be great.

Regards,

KSP

Not applicable

Re: Macro to create PDF

Hi Palani,

Please find the attached file for PDF Export n Mail, hope it will help you to solve the issue.

omid5ive
Not applicable

Re: Macro to create PDF

i attached it

you should set your mail and password on macro

Not applicable

Re: Macro to create PDF

Thanks Omid Ebrahimi and qvarunprasadh

Thanks for your quik help. I tried creating PDF from the scratch through Bullzip. No Luck.

I am running on Windows 7 Professional 64bit. Perhaps Windows 7 64 bit is not allowing direct saving of PDF, without a SaveAs dialog capturing location and filename.

The code you have shared seemed to be working perfect. May I know which OS you are operating on?

Regards,

KSP

omid5ive
Not applicable

Re: Macro to create PDF

i use os same you

windows 7 64 bit

Not applicable

Re: Macro to create PDF

Hi Omid Ebrahimi,

Thanks for sharing the doc. Appreciate. I copy pasted the script andd created same variables. Following are observed:

1. PDF printing still opens the SaveAs dialogue

2. In mail, I changed the port number to 25 (as advised by my hosting company). Mail script neither shows success nor error. This is weird.

If you can assist, it would be great. I am attaching my doc.

Regards,

KSP

omid5ive
Not applicable

Re: Macro to create PDF

hi kspalani

i check it

it work correctly with no saveas dialog

are you create qv folder in drive c?

and for second question

icant undrstand your problem can you explain it?