5 Replies Latest reply on Oct 22, 2017 8:59 PM by Shrinivas Kulkarni

    Programmatically printing variable fields

    Shrinivas Kulkarni

      Hello,

       

      I've created a label which contains variable fields having Arial font. I want to print this label with variable data using c#. How can I do it?

      Thanks,

      Shrinivas

        • Re: Programmatically printing variable fields
          Robin West

          Hi Shrinivas,

          Are you asking how to create a variable field label?  Are you using a label design tool?

          Are you asking how to use the Arial font with variable fields in a page description language like ZPL?

          Or are you asking how to communicate/print to the printer with C#?

           

          You need to use page description language to truly have a variable field label. Label design tools are available to help.  If you want to have Arial font for your variable fields, you need to license, convert, and install it on the printer.  Sending the print data to the printer using C# you need to think about the OS you are using.  Then you can find out methods to send raw data via C# code on that OS.

            • Re: Programmatically printing variable fields
              Shrinivas Kulkarni

              Hello Robin West,

               

              Thanks for reply. I have already designed the label in designer. I have used Arial font for all the fields. This label, I want to print using my program developed in c#, Windows OS (My application tests the Device Under Test and if it is tested OK, application generates the Label using Zebra printer). I have created the PRN file of label designed in designer and this file I want to print. If I use Zebra fonts, I can read this file easily and replace the fields that I want to print (e.g. Serial Number, Date etc.). But if I use Arial font, the file is not readable means I can not replace the fields that I want to print, as it is graphics. Is there any way to read this and replace with appropriate data and print?

               

              Thanks

              Shrinivas

                • Re: Programmatically printing variable fields
                  Robin West

                  Hi Shrinivas,

                  The only way to have variable fields with non-default fonts is to load the font onto the printer.  This is due to font copyright and licensing issues.  Here are the steps:

                  1. License the font: Go to a site like fonts.com and license Arial or whatever font you want to use.  Arial is not cheap (it's why Microsoft switched it's default font to Calibri - they own the copyright to it).  You can also look for free fonts that are similar on fonts.google.com.  Using the Arial file on your computer is not legal.

                  2. Download the font to a computer.

                  3. Install either Printer Setup Utilities or ZebraNet Bridge Enterprise.  I prefer ZebraNet Bridge for font loading, but Setup Utility is good if you are low on printer memory.  They both have font wizards to take you through loading the font to a printer.

                  4. Once the font is installed, design your label with a designer using font 0, not Arial.

                       Tip: If you make the fields variable in your design, then export (not print) the design to a file, you get a different output called a stored format.  This one will allow you to load the stored format onto a printer once, then, recall and print it with minimal data - just the variable fields.  See Exercise 6 in the ZPL Manual.

                  5. Modify the print (or export) output to add the following command after the first ^XA to tell the printer to use your newly added font in this format: ^CWZ,E:fontname

                  6. Modify the print (or export) output to have all ^A0 commands be ^AZ

                   

                  The printer should then use the font you choose.