Generate barcode component from the gateway context

Hi, I’m trying to print a barcode when a opc tag value changes. I want to trigger the print command from the gateway because that is where the printer is connected.

Currently this is the function I have and it runs fine on the client, however the class “com.inductiveautomation.factorypmi” is not available from the gateway context. ¿Is there any way to get the PMIBarcode class from the gateway context?

def printBarcode(code):
	from com.inductiveautomation.factorypmi.application.components  import PMIBarcode
	#Creamos un componente de tipo PMIBarcode
	codigoBarras = PMIBarcode()
	#Definimos el tipo de codigo
	#Asignamos el codigo
	#Tamano del componente
	#Altura del codigo
	#Ancho de la barra mas estrecha
	#Mostramos el codigo numerico debajo del codigo de barras
	#Ponemos el codigo negro y el fondo blanco
	#Generamos el trabajo de impresion
	job = system.print.createPrintJob(codigoBarras)
	#Mostramos el dialogo de impresion
	#Ajustamos el componente a la pagina
	#Formato apaisado
	#Orden de imprimir

Thank you!!

No, none of the Swing-based user interface classes are present in the gateway. This is the primary reason the Reporting module was rebuilt from scratch – generating reports from the gateway needed an independent set of graphical objects. Consider using the Reporting module to produce your barcode.

Thank you for your answer. I think I’ll just try to run the script in the client as we don’t have a license for the Reporting Module.

There are also several webservices out there that can generate barcodes. You could call a web service and it would return an image of the barcode for you to use. Also, if you are printing to a label printer, you can usually send code directly to the printer to print barcodes… Lots of options here depending on your architecture.