Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
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
You have changed the filename as dashboard2.pdf , obviously it will create a new file. Then where exactly the issue? explain it
New file is created but Dashboard2.pdf contains data of Dashboard1.pdf.
this is main issue....
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?
Two different QVW's as well as the two QVW(reports) is having totaly different data.
Check the values of report in dashboard2
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
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"