Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Issue in PDF Creation

Hi,

I am using the below macro code for pdf generation of Dashboard1.qvw:

Sub PrintReports
  'This macro can be used to print pdf reports into the directory structure using bullzip pdf

ActiveDocument.GetApplication.Sleep 2000
   ActiveDocument.PrintReport "RP01", "Bullzip PDF Printer"
  ActiveDocument.GetApplication.Sleep 10000

MyPrintPDFWithBullZip "C:\Qlikview\Dashboard1.pdf"


ActiveDocument.GetApplication.Sleep 10000


End Sub

FUNCTION MyPrintPDFWithQlikViewPDF (pdfOutputFile)

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

END FUNCTION

FUNCTION MyPrintPDFWithBullZip (pdfOutputFile)

'need to init the printername, otherwise the assignment of the values will fail
Set obj_printer_util = CreateObject("Bullzip.PDFUtil")
printername = obj_printer_util.defaultprintername

'init the BullZip preferences object
set obj = CreateObject("Bullzip.PDFSettings") 'For 32Bit System u use PDFPrinterSettings

obj.printername = obj_printer_util.defaultprintername 'assign the printername
obj.SetValue "Output" , pdfOutputFile
obj.SetValue "ConfirmOverwrite", "no"
obj.SetValue "ShowSaveAS", "never"
obj.SetValue "ShowSettings", "never"
obj.SetValue "ShowPDF", "no"
obj.SetValue "RememberLastFileName", "no"
obj.SetValue "RememberLastFolderName", "no"
obj.SetValue "ShowProgressFinished", "no"
obj.SetValue "ShowProgress", "no"
obj.WriteSettings True

END FUNCTION 

and pdf file is generated from this.

I used same code for pdf generation of Dashboard2.

just i Change the file name "C:\Qlikview\Dashboard2.pdf"

but when i run the Dashboard2.qvw macro for pdf generation after Dashboard1.qvw then it will create the different file named dashboard2.pdf but having same details/data of dashboard1.pdf or sometimes this happens that dashboard2.pdf is not created and data is updated in dashboard1.qvw.

Anyone face this issue ?

Kindly help to resolve.

1 Solution

Accepted Solutions
Not applicable
Author

try in this way:

ActiveDocument.GetApplication.Sleep 2000
MyPrintPDFWithBullZip "C:\Qlikview\Dashboard1.pdf"
  ActiveDocument.GetApplication.Sleep 10000

ActiveDocument.PrintReport "RP01", "Bullzip PDF Printer"


ActiveDocument.GetApplication.Sleep 10000

swapping the two instances should work !!

also I  suggest to add init into the bullzif function like this:

set obj = CreateObject("Bullzip.PDFSettings") 'For 32Bit System u use PDFPrinterSettings
obj.Init
obj.printername = obj_printer_util.defaultprintername 'assign the printername

let me know if this solve your issue

Matteo

View solution in original post

7 Replies
sivarajs
Specialist II
Specialist II

You have changed the filename as dashboard2.pdf , obviously it will create a new file. Then where exactly the issue? explain it

Not applicable
Author

New file is created but Dashboard2.pdf contains data of Dashboard1.pdf.
this is main issue....

sivarajs
Specialist II
Specialist II

Guess you are using same report Id for two files.

ActiveDocument.PrintReport "RP01", "Bullzip PDF Printer"

have you created two different qvw file with same data?

Not applicable
Author


Two different QVW's as well as the two QVW(reports) is having totaly different data.

sivarajs
Specialist II
Specialist II

Check the values of report in dashboard2

Not applicable
Author

try in this way:

ActiveDocument.GetApplication.Sleep 2000
MyPrintPDFWithBullZip "C:\Qlikview\Dashboard1.pdf"
  ActiveDocument.GetApplication.Sleep 10000

ActiveDocument.PrintReport "RP01", "Bullzip PDF Printer"


ActiveDocument.GetApplication.Sleep 10000

swapping the two instances should work !!

also I  suggest to add init into the bullzif function like this:

set obj = CreateObject("Bullzip.PDFSettings") 'For 32Bit System u use PDFPrinterSettings
obj.Init
obj.printername = obj_printer_util.defaultprintername 'assign the printername

let me know if this solve your issue

Matteo

Not applicable
Author

Check the name of your report in your app2.

The code says the name should be RP01 as for the app1.

If not the same, change the code below

ActiveDocument.PrintReport "RP01" to  ActiveDocument.PrintReport "XXXX"