When we talk about printers, a lot of you will probably think of standard big laser printers that can print A4 format documents. However, documents are not the only thing that is being printed. In enterprise world, companies often need to print tickets, receipts, labels that can be scanned by barcode scanners. They are showing prices or, they are used to label what is inside of package or they are used for tracking of goods for instance. Millions of such tickets, labels and receipts are being printed in the world each day in industries such as warehousing, logistics, supply chain, maintenance, manufacturing, health care or public sector. Standard printers are not suitable for printing these. Portable printers are used instead. Zebra is a global leader of manufacturers of portable industrial printers with over 50% of market share. If you need to print something on portable printer, you need an additional device that will tell the printer what to print. You can use a desktop PC or a smartphone for instance. Obviously you cannot use a desktop PC if you want to print something in the field or inside the warehouse or on-the-go. A much better option is to go for a smartphone. However, mobile developers often find it too hard to make the printers work.
Zebra's SDK is suitable especially for low-level programming. What does this mean? It means that making the printers work will take significant amount of time even for developers with advanced skills. To print a useful ticket or receipt via Zebra printer, mobile developer needs to dig into the code of Zebra's SDK to find out everything about the functionality. He needs to understand various networks such as Bluetooth or Wifi and their protocols. When something is being printed, developer is working with printer commands whenever he needs to align text, print text, print picture or barcode, insert lines or other objects.
Resco's solution will significantly decrease the time the developer needs to code such application that will print something on Zebra printer via Windows Mobile or CE device. Check out the video in which we demonstrate the use of the sample on real devices:
It consists of printing interface and reporting interface.
Printing Interface
Printing interface is using Zebra's SDK to connect to printer and send the printing commands. It is an extension to Zebra's SDK and it provides additional code model. The developer now doesn't need to send direct commands to printer. This is ensured via Resco's interface.
Reporting Interface
Reporting interface is working hand-in-hand with printing interface. It works directly with C# language. Developer can define a report in a form of an XML template which can be bind to any data source. There is a list of orders and customers in a sample application that is included with Resco MobileForms Toolkit.
Here is a sample XML template that will print some text, lines, list and barcode.
="1.0" ="utf-8"
<page Width="400" Mode="Journal">
-->
<panel Height="26" DataSource="Header">
<text X="0" Y="0" Font="7" FontSize="0" MaxLength="14" Width="170"
HAlign="Left">Count:</text>
<text X="170" Y="0" Font="7" FontSize="0" MaxLength="19" Width="230"
HAlign="Right" DataMember="(Default)" />
<line X="0" Y="24" X1="400" Y1="24" LineWidth="2" />
</panel>
-->
<repeatpanel Height="24" DataSource="Data">
<text X="0" Y="0" Font="7" FontSize="0" DataMember="(Default)" />
</repeatpanel>
-->
<panel Height="120" DataSource="Barcode">
<barcode X="0" Y="0" Type="Code128" Width="400" Height="96"
HAlign="Center" DataMember="(Default)" />
<text X="0" Y="96" Font="7" FontSize="0" Width="400" HAlign="Center"
DataMember="(Default)" />
</panel>
</page>
Template consists of several report objects such as 'page', 'panel', 'text', etc. that are defined in reporting interface.
Defining New Custom Reporting Objects
Developer can also add some of his own reporting objects that he needs. This is an example how to define a new 'rectangle' report object:
using System;
namespace Resco.Report
{
public class ReportRectangle : ReportElement
{
public ReportRectangle()
{
}
public int Width { get; set; }
public int Height { get; set; }
public int Thickness { get; set; }
public override void Print(Resco.Printer.IPrinter printer)
{
printer.PrintRectangle(this.X, this.Y, this.Width,
this.Height, this.Thickness);
}
public override void Scale(System.Drawing.SizeF scaleFactor)
{
this.Width = (int)(this.Width * scaleFactor.Width);
this.Height = (int)(this.Height * scaleFactor.Height);
base.Scale(scaleFactor);
}
}
}
Define new printer interface method for new command:
using System;
using System.Drawing;
namespace Resco.Printer
{
public interface IPrinter : IDisposable
{
void PrintRectangle(int x, int y, int width, int height, int thickness);
}
}
Implement the new command method to the PrinterZebra
class:
public void PrintRectangle(int x, int y, int width, int height, int thickness)
{
m_toolsUtil.SendCommand(String.Format("BOX {0} {1} {2} {3} {4}" + NL, x,
m_yOffset + y, x + width, m_yOffset + y + height, thickness));
}
And this is the example how to use our rectangle in XML:
<panel Height ="100">
<rectangle X="0" Y="0" Width="400" Height="100" Thickness="2" />
</panel>
Developer can define more complex objects in a similar way.
Zebra printing sample will be accessible only for users with active subscription of Resco MobileForms Toolkit.
You can download the sample from https://portal.resco.net/ProductDownloads.aspx.
Product info: http://www.resco.net/developer/mobileformstoolkit/