Page 1 of 1

Printing arbitrary text via a script

Posted: Fri Mar 15, 2013 8:00 am
by mark.monroe
Below is an example script that can be used to send text to a printer. This only works in iX Developer 2.0.

Code: Select all

// Press F1 to get help about using script.
// To access an object that is not located in the current class, start the call with Globals.
// When using events and timers be cautious not to generate memoryleaks,
// please see the help for more information.

namespace Neo.ApplicationFramework.Generated
    using System.Windows.Forms;
    using System;
    using System.Drawing;
    using Neo.ApplicationFramework.Tools;
    using Neo.ApplicationFramework.Common.Graphics.Logic;
    using Neo.ApplicationFramework.Controls;
    using Neo.ApplicationFramework.Interfaces;
    using Neo.ApplicationFramework.Common.Printer.Document;
    using Neo.ApplicationFramework.Common.Service;
    using Neo.ApplicationFramework.Interfaces.Printer;

    public partial class Screen1
		void Button1_Click(System.Object sender, System.EventArgs e)
		/// <summary>
		/// Service to print text to the print device
		/// setup by the alarmdistributor settings menu.
		/// </summary>
		void PrintMessage(string text)
			IPrinterServiceCF printerService = ServiceContainerCF.GetServiceSafe<IPrinterServiceCF>();
			if (printerService != null)
				Paragraph paragraph = new Paragraph(text);
				FlowDocument flowDocument = new FlowDocument();
				catch (Exception ex)
				MessageBox.Show("No printer device configured!");

Re: Printing arbitrary text via a script

Posted: Tue Jan 21, 2020 5:37 pm
by Chris T.