Does the Ignition gateway server have a Printer installed on it called PLC-Office ? Also, you’ll have to make sure the Ignition service has access to the shared file as well. You didn’t specify much about your setup so I’ll assume you’re using Windows 10; out the box Ignition installs will use the SYSTEM user which probably won’t be able to read the PDF in the file path. Another thing to point out is the file path for every \ you need an extra one to escape it.
new path:
\\\\amifile\\Departments\\Work Instructions and Procedures\\Forms\\QD 711 Daily Air Compressors Checklist.PDF
I agree with you. Is there documentation for printing from the gateway and not a component? I was testing the script how it was to see if it could work.
I haven’t tried to print a file from the network before but I don’t think it will work the way your doing it. the createPrintJob function is looking for a component. Your passing it a string which I’m sure is the location of the file you want to print but I doubt it will open the file from the string.
The easiest way I could see doing it is by using the PDF viewer. You could have it hidden on a screen or open a popup with it to load the PDF and print it, then close it again. Easiest I would think would be having the object hidden on the screen. Using the .loadPDFBytes function to put your PDF into the viewer, then use the .print function to print it. You would need to use the system.file.readFileAsBytes() function to turn your pdf into the bytes needed by the PDF viewer. If you set the showDialog in your .print call to false, I would assume that it will use the clients default printer.
I looked through the gateway logs. I get a error saying print has no attribute
Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 4, in AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'print'
... 13 common frames omitted
job =system.print.createPrintJob('\\amifile\Departments\Work Instructions and Procedures\Forms\QD 711 Daily Air Compressors Checklist.PDF')
Then it will keep giving you that error. ‘\amifile\Departments\Work Instructions and Procedures\Forms\QD 711 Daily Air Compressors Checklist.PDF’ is a string instead of an object so it won’t have a print attribute.