I am able to print the power table with the script below with a mouse click but it is very hard to see. Is there away to fit it to the page so it is more readable?
# Get a reference to the power table
powerTable = event.source.parent.getComponent("Power Table") # Get a reference to the table
powerTable.print()
Traceback (most recent call last):
File "<event:actionPerformed>", line 4, in <module>
AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'createPrintJob'
Sorry, typo. Lesson: use the linked examples, not the typo in my post. Take note of that error message – it usually means a typo in a function name. I also don’t recommend you keep the “powerTable” variable name for a print job – not if you want to understand this code when you revisit it next year.
The system.print function doesn’t perform layout again (I believe) - so the print job will keep the same aspect ratio as whatever client is actively rendering it/however it was laid out in the designer. It will scale one axis to fit (in this case width) but not reflow the contents to fit vertically. This is just a limitation of the system.print functions. You may need to look into the reporting module if you need dynamic printouts of data.