Hide the print dialog but print barcode

Here is the code I have on a button to print a barcode. The problem is that when I uncomment the setshowprintdialog(0) line, the print dialog goes away BUT so does the barcode when it is printed. Using a DYMO LabelWriter 450 Turbo printer if that makes a difference. Ignition 7.9.2

	#Print the Barcode to a Label
	job = system.print.createPrintJob(event.source.parent.getComponent('Barcode'))
	job.setPrinterName("DYMO LabelWriter 450 Turbo")


If you remove the try/except, is an error being generated when the script is run without the showPrintDialog() method?

No error, and I tried without the try except. I just get blank labels printing.

Can you try printing to a standard paper printer first? If it prints there, it is most likely related to page setup / paper layout and the margins when sending to the label printer are cutting off the barcode.

1 Like

Thanks for the suggestion Ryan.

The barcode did print on the regular paper. I did not specify my page width and height and so the default was going in as 8.5 and 11 which was moving my image off of the label, but when I had the dialog it was using recommended settings from the driver. So I just measured the label and entered in the setPageWidth and height. Iā€™m all set now. Thanks.