Zebra LinkOS Multiplatform SDK for Xamarin  1.1
Link-OS Portable Class Library Plugin for Xamarin
LinkOS.Plugin.Abstractions.IGraphicsUtil Interface Reference

This is an utility class for printing images on a device. More...

Inheritance diagram for LinkOS.Plugin.Abstractions.IGraphicsUtil:
LinkOS.Plugin.Abstractions.IZebraPrinter LinkOS.Plugin.ZebraPrinterImplementation

Public Member Functions

void PrintImage (string imageFilePath, int x, int y, int width=0, int height=0, bool insideFormat=false)
 Prints an image from the connecting device file system to the connected device as a monochrome image. Note: if the image resolution is large(e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception. More...
 
void StoreImage (string printerDriveAndFileName, string imageFilePath, int width, int height)
 Stores the specified image to the connected printer as a monochrome image. The image will be stored on the printer at printerDriveAndFileName with the extension GRF. If a drive letter is not supplied, E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored (E:FILE.BMP becomes E:FILE.GRF). If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception. More...
 
void PrintImage (object os_image, int x, int y, int width=0, int height=0, bool insideFormat=false)
 Prints an image from the connecting device system to the connected device as a monochrome image. Note: if the image resolution is large(e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception. More...
 
void StoreImage (string printerDriveAndFileName, object os_image, int width, int height)
 Stores the specified image to the connected printer as a monochrome image. The image will be stored on the printer at printerDriveAndFileName with the extension GRF. If a drive letter is not supplied, E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored (E:FILE.BMP becomes E:FILE.GRF). If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception. More...
 

Detailed Description

This is an utility class for printing images on a device.

See IPrinterStatus for PreCheckPrinterStatus() and PostPrintCheckStatus() code.
See IConnection for CheckPrinterLanguage() code.

using LinkOS.Plugin;
public void printGraphicFromPath()
{
IConnection connection = ConnectionBuilder.Current.Build("TCP:192.168.1.100:9100");
try
{
connection.Open();
if (!CheckPrinterLanguage(connection))
return;
if (!PreCheckPrinterStatus(connection))
return;
IZebraPrinter printer = ZebraPrinterFactory.Current.GetInstance(connection);
string path = @"/Documents/Zebra_Print.jpg";
printer.PrintImage(path, 0, 0);
PostPrintCheckStatus(connection);
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("Exception:" + e.Message);
}
finally
{
if (connection.IsConnected)
connection.Close();
}
}

Member Function Documentation

◆ PrintImage() [1/2]

void LinkOS.Plugin.Abstractions.IGraphicsUtil.PrintImage ( string  imageFilePath,
int  x,
int  y,
int  width = 0,
int  height = 0,
bool  insideFormat = false 
)

Prints an image from the connecting device file system to the connected device as a monochrome image. Note: if the image resolution is large(e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.

Parameters
imageFilePathFull path to image file. (The image must be either a PNG or JPG).
xhorizontal starting position in dots.
yvertical starting position in dots.
widthdesired width of the printed image. Passing a value less than 1 will preserve original width.
heightdesired height of the printed image. Passing a value less than 1 will preserve original height.
insideFormatboolean value indicating whether this image should be printed by itself (false), or is part of a format being written to the connection (true).

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ PrintImage() [2/2]

void LinkOS.Plugin.Abstractions.IGraphicsUtil.PrintImage ( object  os_image,
int  x,
int  y,
int  width = 0,
int  height = 0,
bool  insideFormat = false 
)

Prints an image from the connecting device system to the connected device as a monochrome image. Note: if the image resolution is large(e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.

Parameters
os_imageIn Android - Android.Graphics.Bitmap image. In iOS - a CGImageRef image
xhorizontal starting position in dots.
yvertical starting position in dots.
widthdesired width of the printed image. Passing a value less than 1 will preserve original width.
heightdesired height of the printed image. Passing a value less than 1 will preserve original height.
insideFormatboolean value indicating whether this image should be printed by itself (false), or is part of a format being written to the connection (true).

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ StoreImage() [1/2]

void LinkOS.Plugin.Abstractions.IGraphicsUtil.StoreImage ( string  printerDriveAndFileName,
string  imageFilePath,
int  width,
int  height 
)

Stores the specified image to the connected printer as a monochrome image. The image will be stored on the printer at printerDriveAndFileName with the extension GRF. If a drive letter is not supplied, E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored (E:FILE.BMP becomes E:FILE.GRF). If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.

Parameters
printerDriveAndFileNamepath on the printer where the image will be stored.
imageFilePathFull path to image file. (The image must be either a PNG or JPG).
widthdesired width of the printed image, in dots. Passing -1 will preserve original width.
heightdesired height of the printed image, in dots. Passing -1 will preserve original height.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.

◆ StoreImage() [2/2]

void LinkOS.Plugin.Abstractions.IGraphicsUtil.StoreImage ( string  printerDriveAndFileName,
object  os_image,
int  width,
int  height 
)

Stores the specified image to the connected printer as a monochrome image. The image will be stored on the printer at printerDriveAndFileName with the extension GRF. If a drive letter is not supplied, E will be used as the default (e.g. FILE becomes E:FILE.GRF). If an extension is supplied, it is ignored (E:FILE.BMP becomes E:FILE.GRF). If the image resolution is large (e.g. 1024x768) this method may take a long time to execute or throw an OutOfMemoryError exception.

Parameters
printerDriveAndFileNamepath on the printer where the image will be stored.
os_imageIn Android - Android.Graphics.Bitmap image. In iOS - a CGImageRef image
widthdesired width of the printed image, in dots. Passing -1 will preserve original width.
heightdesired height of the printed image, in dots. Passing -1 will preserve original height.

Implemented in LinkOS.Plugin.ZebraPrinterImplementation.


The documentation for this interface was generated from the following file: