FontUtil Interface |
Namespace: Zebra.Sdk.Printer
Name | Description | |
---|---|---|
DownloadTteFont(Stream, String) |
Adds a TrueType® font to a profile and stores it at the specified path as a TrueType® extension (TTE).
| |
DownloadTteFont(String, String) |
Adds a TrueType® font file to a profile and stores it at the specified path as a TrueType® extension (TTE).
| |
DownloadTtfFont(Stream, String) |
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
| |
DownloadTtfFont(String, String) |
Adds a TrueType® font file to a profile and stores it at the specified path as a TTF.
|
using System; using Zebra.Sdk.Comm; using Zebra.Sdk.Printer; public class FontUtilExample { public static void Main(string[] args) { TcpConnection connection = new TcpConnection("192.168.1.32", TcpConnection.DEFAULT_ZPL_TCP_PORT); try { connection.Open(); ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection); ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter); if (linkOsPrinter != null) { linkOsPrinter.DownloadTtfFont("C:\\BaroqueScript.ttf", "E:Baroque"); } } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } catch (ZebraPrinterLanguageUnknownException e) { Console.WriteLine(e.ToString()); } finally { connection.Close(); } } }
using Android.App; using Android.OS; using Android.Views; using Android.Widget; using System; using System.Threading.Tasks; using Zebra.Sdk.Comm; using Zebra.Sdk.Printer; public class FontUtilExample : Activity { protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout layout = (LinearLayout)View.Inflate(this, Android.Resource.Layout.ActivityListItem, null); layout.Orientation = Orientation.Vertical; Button testButton = new Button(this) { Text = "Run Font Util Example", LayoutParameters = new ViewGroup.LayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)) }; layout.AddView(testButton); SetContentView(layout); testButton.Click += async (sender, e) => { await Task.Run(() => { string ipAddress = "1.2.3.4"; StoreFont(ipAddress); }); }; } public void StoreFont(string ipAddress) { TcpConnection connection = new TcpConnection(ipAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT); try { connection.Open(); ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection); ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter); if (linkOsPrinter != null) { linkOsPrinter.DownloadTtfFont("/path/to/font/file/BaroqueScript.ttf", "E:Baroque"); } } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } catch (ZebraPrinterLanguageUnknownException e) { Console.WriteLine(e.ToString()); } finally { connection.Close(); } } }
using CoreGraphics; using System; using System.Threading.Tasks; using UIKit; using Zebra.Sdk.Comm; using Zebra.Sdk.Printer; public class FontUtilExample : UIViewController { public FontUtilExample(IntPtr handle) : base(handle) { UIButton testButton = new UIButton(UIButtonType.System) { Frame = new CGRect(25, 25, 300, 150) }; testButton.SetTitle("Run Font Util Example", UIControlState.Normal); testButton.TouchUpInside += async (sender, e) => { await Task.Run(() => { string ipAddress = "1.2.3.4"; StoreFont(ipAddress); }); }; View.AddSubview(testButton); } public void StoreFont(string ipAddress) { TcpConnection connection = new TcpConnection(ipAddress, TcpConnection.DEFAULT_ZPL_TCP_PORT); try { connection.Open(); ZebraPrinter genericPrinter = ZebraPrinterFactory.GetInstance(connection); ZebraPrinterLinkOs linkOsPrinter = ZebraPrinterFactory.CreateLinkOsPrinter(genericPrinter); if (linkOsPrinter != null) { linkOsPrinter.DownloadTtfFont("/path/to/font/file/BaroqueScript.ttf", "E:Baroque"); } } catch (ConnectionException e) { Console.WriteLine(e.ToString()); } catch (ZebraPrinterLanguageUnknownException e) { Console.WriteLine(e.ToString()); } finally { connection.Close(); } } }