iPrint printing SDK
Simple printing example
private
void print(Context
AppContext)
{
//Creating Settings
object
iSettings set = new
iSettings();
set.SetPaperType(iPaperType.LETTER);
set.PrinterType(iPrinters.HP);
//Creating
Connection object
ipConnection wfc =
new
ipConnection(AppContext);
wfc.ipAddress("192.168.1.10");
wfc.Port(9100);
wfc.Connect();
//Creating a
Printing object
iPrint p = new
iPrint(_context);
p.Connection(wfc);
p.Settings(set);
if
(wfc.isConnected())
{
p.Start();
iObject ob = new iObject();
ob.Text("Hello iPrint!");
p.Add(ob);
p.End();
p.Print();
ob = null;
}
else
{
showDialog(wfc.ErrorMessage(), AppContext);
}
set = null;
wfc = null;
p = null;
}
private void
showDialog(String
Message, Context
AppContext)
{
AlertDialog.Builder dlgAlert = new AlertDialog.Builder(AppContext);
dlgAlert.setMessage(Message);
dlgAlert.setTitle("Hello iPrint");
dlgAlert.setPositiveButton("OK", null);
dlgAlert.setCancelable(true);
dlgAlert.create().show();
}