Hi,
I used this code to print some information and qr code and A logo on cards by zc-350.I have problem for printing logo.
private static string GetTemplateData()
{
return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" +
"<template name=\"TemplateExample\" card_type=\"2\" card_thickness=\"30\" delete=\"no\">\r\n" +
" <fonts>\r\n" +
" <font id=\"2\" name=\"Arial\" size=\"16\" bold=\"yes\" italic=\"no\" underline=\"no\" />\r\n" +
" <font id=\"3\" name=\"Arial\" size=\"8\" bold=\"no\" italic=\"no\" underline=\"no\"/>\r\n" +
" <font id=\"4\" name=\"Arial\" size=\"8\" bold=\"yes\" italic=\"no\" underline=\"no\"/>\r\n" +
" </fonts>\r\n" +
" <sides>\r\n" +
" <side name=\"front\" orientation=\"portrait\" rotation=\"0\" k_mode=\"text\">\r\n" +
" <print_types>\r\n" +
" <print_type type=\"mono\">\r\n" +
" <text field=\"text\" font_id=\"2\" x=\"80\" y=\"650\" width=\"0\" height=\"0\" angle=\"0\" color=\"0x000000\" letter-spacing=\"3px\"/>\r\n" +
" <text field=\"text1\" font_id=\"3\" x=\"280\" y=\"860\" width=\"0\" height=\"0\" angle=\"0\" color=\"0x000000\"/>\r\n" +
" <text field=\"text2\" font_id=\"4\" x=\"280\" y=\"900\" width=\"0\" height=\"0\" angle=\"0\" bold=\"yes\" color=\"0x000000\"/>\r\n" +
" <barcode field=\"qrCode\" code=\"qrCode\" x=\"80\" y=\"830\" width=\"110\" height=\"110\" quiet_zone_width=\"0\"/>\r\n" +
" <graphic field=\"imageLogo\"format=\"bmp\" width=\"100\" height=\"100\" x=\"80\" y=\"80\" delete=\"false\"/>\r\n" +
" </print_type>\r\n" +
" </print_types>\r\n" +
" </side>\r\n" +
" </sides>\r\n" +
"</template>";
}
/// <exception cref="ArgumentException"></exception>
/// <exception cref="System.IO.IOException"></exception>
/// <exception cref="Zebra.Sdk.Card.Exceptions.ZebraCardException"></exception>
/// <exception cref="Zebra.Sdk.Device.ZebraIllegalArgumentException"></exception>
private static Dictionary<string, string> PopulateTemplateFieldData(List<string> templateFields, string CSN)
{
Dictionary<string, string> fieldData = new Dictionary<string, string>();
foreach (string fieldName in templateFields)
{
string CSN1 = CSN.Insert(4, " ");
CSN1 = CSN1.Insert(9, " ");
string fieldValue = "";
switch (fieldName)
{
case "text":
//CSN = CSN.Insert(1, " ");
fieldValue = CSN1;
break;
case "text1":
fieldValue = "text ";
break;
case "text2":
fieldValue = "text";
break;
case "qrCode":
fieldValue = "text";
break;
case "imageLogo":
{
string fileName = "../pic/unnamed.bmp";
fieldValue = fileName;
break;
}
}
All things good work just have problem for logo (an image).It did not work. please give me an advice to solve this problem.
Please, follow the link below with the blog that explains all items you need to cover to work with templates with ZC100/ZC300 printers.
https://developer.zebra.com/community/home/blog/2018/10/18/blog-series-x...
MC
Points: 0
You voted ‘up’
Log in to post comments