Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to print individual sheets to separate PDFs with a script?

I've been working with script, for the first time, trying to print 20 separate sheets as PDFs in an automated way (or maybe to write one large PDF).  I have not (as yet) defined reports for these sheets.  At this time I just want to print them as sheets.

1. What is the script equivilent to menu: File, Print Sheet? (its not Print Report, PrintDocReport or PrintReportEx)

2. If I decided to use doc1.PrintAllSheets, how can I pass in the name of the PDF printer and the PDF file name I wish to write to?

Thx,

Brooks


15 Replies
Not applicable
Author

May be check Default CutePDF Printer Properties Setting on your machine

Not applicable
Author

Hi Gerrit,

I have the PDF-XChange 3.0.

When you run that code do you get 4 files: RP01.PDF, RP02.PDF, RP03.PDF, RP04.PDF?

Brooks

Not applicable
Author

Brooks,

You can manipulate the file name in settings of the PDF-XChange 3.0 printer

I use docname and time to make the file unique.

I then pick these files up with  a script (AutoIT) rename the files and send them out by mail.

printer setting.jpg

Hope this helps.

Gerrit

Not applicable
Author

Hi Gerrit,

Thanks for the post.  I was making some progress yesterday with both PDF XChange and Bullzip.

So the way you do it, is docname always the same (the name of the QVW file)?  But you get separate files by the use of %time%?

Are you creating a different PDF file for each report you defined?  How do you decide how to rename the files later (ie. how do you use the time in the filename to rename it to the report title)?

Brooks

Not applicable
Author

Brooks,

The name of the file is Qlikview Printing + time.

Indeed I create seperate files and they are unique because of the timepart in the filename.

I use a scripttool AutoIT to rename the files  AutoIt - AutoItScript

Code there looks like this:

$search = FileFindFirstFile("D:\Qlikviewdata\AutoQLIK\Qlikview Printing*.*")

If $search = -1 Then Exit

Local $file = FileFindNextFile($search)

If @error Then Exit

FileCopy("D:\Qlikviewdata\AutoQLIK\"&$file, "D:\Qlikviewdata\AutoQLIK\MyNewFile.pdf")

FileDelete("D:\Qlikviewdata\AutoQLIK\"&$file)

etc.

What I basically do is the following:

1. In my task scheduler I start at night an AutoIT script

2. In the script I start a qvw file with the /l option: "C:\Program Files\QlikView\qv.exe" /l "D:\Qlikviewdata\AutoQLIK\my.qvw"

3. In the onpostreload trigger of the document I start my macro (as shown a few posts earlier)

4 I loop throught the directory with the printfiles and rename the created printfiles

5. I send the renamed files out by email.

Regards,

Gerrit

bumin
Partner - Creator II
Partner - Creator II

Hi Dewang,

even when I use your code

  WSHShell.RegWrite "HKEY_CURRENT_USER\Software\PDFCreator\OutputFile", pdfLocation

  WSHShell.RegWrite "HKEY_CURRENT_USER\Software\PDFCreator\BypassSaveAs", "1", "REG_SZ"

pdflocation = c:\temp

reportFile = tempFolder & "\" & "040" & ".pdf"

Qlikview allways creates the file in the directory c:\users\bumin\desktop and

the finename = Qlikview Printing

what is wrong?

thanks and regards

Bumin