Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
As there is direct option to generate excel from table box or charts in qlikview report.But i want to provide option ot generate pdf directly (both for data and charts image).can i achieve this in qlikview?
If you have a pdf printer driver installed, yes.
Yes you can click right on the object and select print as pdf. Otherwise, you can set up report to be exported in pdf in the report tab > Edit Reports and just drag and drop objects from your application.
Hi, you can do it using macro
please check the qvw attached
good luck
Fernando
Hi,
Just as an aside, your script does not work unless you're using the \QlikViewPDF driver. If, like me, you're using the CutePDF printer, it crashes QV.
Thanks.
To use a macro you should use PDFCreator which doesn't crash QV. Here is a sample vbs script :
Dim QV, ActiveDocument
set Qv = CreateObject("QlikTech.QlikView")
QV.OpenDoc "C:\Users\...\......qvw","",""
set ActiveDocument = Qv.ActiveDocument
ActiveDocument.ClearAll
Dim FieldName
FieldName = "Enter the field to split the report into pultiple files"
set mySelections = ActiveDocument.Fields(FieldName).GetPossibleValues ("500")
Dim i
for i = 0 to mySelections.Count - 1
Dim FieldValue
FieldValue = mySelections.Item(i).text
ActiveDocument.Fields(FieldName).Select FieldValue
Print_PDF FieldValue, "filename", "Enter the report ID"
Next
Sub Print_PDF(FieldValue, ReportName, ReportID)
' Designed for early bind, set reference to PDFCreator
Dim pdfjob
Dim sPDFName
Dim sPDFPath
'/// Change the output file name here! ///
sPDFName = ReportName & " - " & FieldValue
sPDFPath = "C:\PDFReports"
Set pdfjob = CreateObject("PDFCreator.clsPDFCreator")
With pdfjob
If .cStart("/NoProcessingAtStartup") = False Then
If .cStart("/NoProcessingAtStartup", True) = False Then
Exit Sub
End if
.cVisible = True
End If
.cOption("UseAutosave") = 1
.cOption("UseAutosaveDirectory") = 1
.cOption("AutosaveDirectory") = sPDFPath
.cOption("AutosaveFilename") = sPDFName
.cOption("AutosaveFormat") = 0 ' 0 = PDF
.cClearCache
End With
' Print the QlikView Report
ActiveDocument.PrintReport ReportID, "PDFCreator"
'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
WScript.Sleep(20)
' in VBScript use WScript.Sleep(20)
Loop
pdfjob.cPrinterStop = False
'Wait until PDF creator is finished then release the objects
Do Until pdfjob.cCountOfPrintjobs = 0
WScript.Sleep(20)
' in VBScript use WScript.Sleep(20)
Loop
pdfjob.cClose
Set pdfjob = Nothing
End Sub
That is a thing of beauty and a joy forever. However, being locked to CutePDF it still has the same problem for me. Also the macro won't work in Webview, sadly.
I don't want to derail the thread from OP's question, but it's much easier to set a PDF driver and use a report or Send to Printer than doing it from scratch.
The script is more for a distribution purpose generating multiple reports with a schedule task.
For the end user, you should stick to the existing Qlikview functionnalities which are right click and 'Print as PDF' or Edit the report for a general report.
if any of our answers were accurate, please mark them so we will be encouraged to keep on supporting people.
Thanks.
Hello All,thanks for reply.But i am not able to generate pdf from my report.CutePDF or any other software i cant install,as it is my office machine.