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

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

pdf print macro not working in Access Point

Hi all,

I am struggling with a pdf printer macro and I need your wish help.

I have a macro in qlikview that prints Invoices, it creates one pdf file per invoice. The invoice layout is defined as a Report and this report is printed once per Invoice. You can find my code below.

This code works in local, with the qlikview developer tool, but when I test it in the access point (in the same machine). it doesn't.

I have a button that launches the macro when I click on it. I tested that the macro runs in access point. It actually does since I see how it execute the rest of the code but the print to pdf.

Can anybody please help me with this, please?

sub printRepPDF3

Set invoiceField=ActiveDocument.Fields("DocumentTable.DocNum")

Set invoiceValues=invoiceField.GetPossibleValues

numInvoices=invoiceValues.Count

If numInvoices>0 then

for i=0 to numInvoices-1

          vCurrentInvoice=invoiceValues.Item(i).text

          invoiceField.Select vCurrentInvoice

          fileName="C:\Invoices\Invoice" & vCurrentInvoice &".pdf"

 

          ActiveDocument.GetApplication.Sleep 2000

          ActiveDocument.PrintReport "RP02", "PDF-XChange 3.0", false

  Set objFSO = CreateObject("Scripting.FileSystemObject")

          objFSO.MoveFile "C:\Invoices\pdf xchange file.pdf", fileName

          ActiveDocument.GetApplication.Sleep 2000

 

Next

ActiveDocument.GetApplication.Sleep 10000

End If

end sub

1 Solution

Accepted Solutions
Not applicable
Author

Hi everyone,

I think I found the answer: Basically, I needed to habilitate the ie plugin in the server. Once I did that, it worked from access point through the server. Also, I tried from a remote computer, downloading and installing the plugin and it works like a charm.

To accomplish that I followed this topic:

http://community.qlik.com/thread/63999

Thanks

Julian

View solution in original post

3 Replies
Not applicable
Author

Hi everyone,

I think I found the answer: Basically, I needed to habilitate the ie plugin in the server. Once I did that, it worked from access point through the server. Also, I tried from a remote computer, downloading and installing the plugin and it works like a charm.

To accomplish that I followed this topic:

http://community.qlik.com/thread/63999

Thanks

Julian

Not applicable
Author

glad you have foud your answer on pdf printer, can you share with use. i was having the same problem. thanks in advance.

Not applicable
Author

Hi,

The vba macro written above works for PDF-Xchange 3.0, I changed my code to use another pdf printer, in this case PDFCreator because it is free. This would be the code:

In my application I print invoices based on customer selected. It prints one PDF per invoice. RP02 is the name of the table that I print

sub printRepPDFCreator

'I get the values for invoices and for customers here.

Set invoiceField=ActiveDocument.Fields("DistributorOrders.DistributorOrderHeaderID")

Set invoiceValues=invoiceField.GetPossibleValues

Set customerField=ActiveDocument.Fields("DistributorOrders.SAP_CustomerName")

Set customerValues=customerField.GetPossibleValues

numInvoices=invoiceValues.Count

If numInvoices>0 then

for i=0 to numInvoices-1

  vCurrentInvoice=invoiceValues.Item(i).text

  invoiceField.Select vCurrentInvoice

  Set customerField=ActiveDocument.Fields("DistributorOrders.SAP_CustomerName")

  Set customerValues=customerField.GetPossibleValues

  vCurrentCustomer=customerValues.Item(0).text

  Print_PDF vCurrentInvoice, vCurrentCustomer & " Order", "RP02"

Next

End If

'This will show a message indicating when it has finished

ActiveDocument.GetApplication.MsgBox("Export Completed ! ")

end sub