Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

PDF generation.

Hi ,

We have requirement to create the PDF of the  Qlikview Document  Loop it through a certain field and then email it to the set of user.

We have to do it through MAcro or nay other option but not NPrinitng..

I have downloaded PDF creator .

Did anybody have any experience with this Kind of requirement . Any solution would be welcome

I have  searched the community and found the below code but this doesn't work . It doesn't do anything. Whne I click the button the Code just opens

  Sub PDF 

ActiveDocument.ClearAll
  Dim FieldName
  FieldName = "Month"


set mySelections = ActiveDocument.Fields(FieldName).GetPossibleValues(15)


Dim i


for i = 0 to mySelections.Count - 1


Dim FieldValue


FieldValue = mySelections.Item(i).text

ActiveDocument.Fields(FieldName).Select FieldValue


Print_PDF FieldValue, "Document Report - 1", "RP01"

Next

End Sub


Sub Print_PDF(Month, 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 RP01, "PDFCreator"



'Wait until the print job has entered the print queue
Do Until pdfjob.cCountOfPrintjobs = 1
ActiveDocument.GetApplication.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
ActiveDocument.GetApplication.Sleep 20
' in VBScript use WScript.Sleep(20)
Loop
pdfjob.cClose
Set pdfjob = Nothing


End Sub

' ActiveDocument.PrintReport RP01, "PDFCreator"

Thanks

Medha

2 Replies
tresesco
MVP
MVP

Did you contemplate on PDF Distributor?

Not applicable
Author

I don't have PDF Distributor.