5 Replies Latest reply: Jan 27, 2012 7:51 AM by Martin Vierling RSS

    QlikviewPDF on 64bit server

    tom1977

      Hi,

      I finally got the QlikviewPDF software running on my Windows Server 2008 machine.

      I tested the development on my laptop and all works fine, the macro prints all reports to the chosen directory. Now, when I try to run the macro on the server, it prints the document but asks for every document the name of the pdf file and standard proposes My Documents as the outputfolder.

       


      PrintReportPDF reportID, reportFile
      ....
      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"
      ActiveDocument.PrintReport oReport, "QlikviewPDF", false
      set WSHShell = nothing
      end function


      This works great on Windows XP but not on our 64bit server, could this be because we installed Qlikview with the compatibily wizard? Or do I need to alter some parameters?

      The RegWrite statements work fine, the "error" seems to be in the ActiveDocument.PrintReport line.

      Thanks in Advance,

      Tom

       

       

        • QlikviewPDF on 64bit server

          I had the same issue. I solved it by adding a vbs function which check that the pdf is generated before setting the registry back to normal.

          When you run the print function, and then set your registry settings back to normal, it can happens that pdfprinter engine didn't run the print function before registry is back to normal. Therefore when it runs the printing, registry settings are set to bypasssaveas = 0.

          The function I run is as followed:

          sub checkOutputFile(psQVWDocument,pdfFile)
          ' Check if pdf file exists
          Set fileTest = CreateObject("Scripting.FileSystemObject")
          currentStatus = fileTest.FileExists (pdfFile)
          ii=0
          while currentStatus = false and ii <10
          rem ** let QV sleep for 1 seconds **
          psQVWDocument.GetApplication.Sleep 1000
          currentStatus = fileTest.FileExists (pdfFile)
          ii = ii +1
          wend
          set fileTest = nothing
          end sub

          So before resetting the registry settings, you should wait that your pdf file is generated.

          I hope this will help you to solve your issue.

          Rgds,

          Sébastien

          • QlikviewPDF on 64bit server

            Hi,

            I have the same issue with our x64-Server and the reason is as follow. There is a Preferences.exe in the QlikViewPDF installation folder which sets additional parameters and/or ignores the registry. So if you specify there (in the preferences) a certain output folder and also tick the box 'Use print job name to save PDF file under default folder automatically' then the SaveAs Dialogue will disappear. Unfortunately I can not change the file name from 'QlikViewPrinting.pdf' to another one. If anyone comes up with a solution for this it will be very appreciated.

            Thanks

            Rgds,

            Stephan

              • QlikviewPDF on 64bit server

                I had the same problem in Windows 7 environment. On installing QlikViewPDF writer, I noticed that the registry keys are different than what is stated in the scripts mentioned in the forum so far. I have modified the scripts and have been successful in creating the reports.

                 

                 

                '***************************************************
                'Functions creates the reports in PDF format
                '***************************************************
                sub CreateReports

                tempFolder = "d:\temp"
                reportID = "RP02"
                set rep = ActiveDocument.GetReport(reportID)
                reportName = rep.Name

                'Create the file name with path
                reportFile = tempFolder & "\" & reportID & "_" & reportName & ".pdf"

                'print the report
                printReportPDF reportID, tempFolder 'Call the function

                'Rename the report
                checkOutputFile reportFile, tempFolder 'Call the function

                call ClearDefault() 'Call the function

                end sub

                '***************************************************
                'Actual function to print the PDF format without being asked for location to save
                '***************************************************
                function printReportPDF(oReport, pdfLocation)

                Set WSHShell = CreateObject("WScript.Shell")
                WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\DefaultLocation", pdfLocation, "REG_SZ"
                WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseJobName", "1", "REG_SZ"
                WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseDefaultLocation", "1", "REG_SZ"

                'QV Print

                ActiveDocument.PrintReport oReport, "QlikViewPDF",false

                set WSHShell = nothing

                 

                end function



                '***************************************************
                'Function to reset the PDF printing to normal mode
                '***************************************************
                function ClearDefault()

                Set WSHShell = CreateObject("WScript.Shell")
                WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseJobName", "0", "REG_SZ"
                WSHShell.RegWrite "HKCU\Software\CUSTPDF Writer\UseDefaultLocation", "0", "REG_SZ"
                set WSHShell = nothing

                end function

                '***************************************************
                'Checks the output file before renaming the report
                '***************************************************
                function checkOutputFile(pdfFile,pdfLocation)

                Set fileTest = CreateObject("Scripting.FileSystemObject")

                'Delete any previous version of the file
                if fileTest.FileExists(pdfFile) then
                fileTest.DeleteFile pdfFile
                End if

                'Check if the temp pdf report file has been generated
                strTempFile = pdfLocation & "\" & "QlikView Printing.pdf"
                currentStatus = fileTest.FileExists (strTempFile)
                if currentStatus = false then
                ActiveDocument.GetApplication.Sleep 1000
                checkOutputFile pdfFile,pdfLocation
                else
                'rename the file
                fileTest.MoveFile strTempFile, pdfFile
                end if
                set fileTest = nothing
                end function

                Do let me know if this works for you.

                Nimish