Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9270461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:22:33+00:00 2026-06-18T15:22:33+00:00

This will print (although still ugly) on the Zebra QL220 belt printer from my

  • 0

This will print (although still ugly) on the Zebra QL220 belt printer from my CE/CF app running on a Motorola MC3100 handheld:

public void PrintBarcode(string barcode, string UPC, string description, decimal listPrice)
{
    using (SerialPort serialPort = new SerialPort())
    {
        serialPort.BaudRate = 19200;
        serialPort.Handshake = Handshake.XOnXOff; 
        serialPort.DataBits = 8;
        serialPort.Parity = Parity.None;
        serialPort.StopBits = StopBits.One; // other choice is Two (see p. 14-21 in CPCL pdf)
        serialPort.PortName = "COM1:"; 

        serialPort.Open(); 

        Thread.Sleep(2500); // I don't know why this is needed, or if it really is...

        serialPort.Write("! 0 200 200 210 1\r\n");

        serialPort.Write("TEXT 4 0 30 40 Hola el Mundo\r\n"); //Bonjour le Monde --- Hola el Mundo --- Hallo die Welt
        serialPort.Write("TEXT 4 0 30 40 \r\n");

        serialPort.Write("BARCODE-TEXT 7 0 5\r\n"); 
        serialPort.Write(string.Format("BARCODE 128 1 1 50 150 10 {0}\r\n", barcode));
        serialPort.Write("TEXT 4 0 30 40\r\n");
        serialPort.Write("FORM\r\n");
        serialPort.Write("PRINT\r\n");

        serialPort.Close();
    }
}

…but all together, like half-manic teens in a mosh pit – the barcode, printed last, is actually at the highest point on the paper, and the “Hola el Mundo” and what looks like “FOIPM” (how did that get there?!?), too.

If "TEXT 4 0 30 40\r\n" is not a way to send CRLFs, what is?

UPDATE

I noticed I had a typo in the args to print the barcode. This:

    serialPort.Write(string.Format("BARCODE 128 1 1 50 150 10 {0}\r\n", barcode));

…this should have been this:

    serialPort.Write(string.Format("BARCODE 128 1 1 50 150 130 {0}\r\n", barcode));

…but when I “fixed” it (changed the vertical starting point from 10 to 130), the printed result was identical! Excuse my French, but what the North Dakota is going on here?!?

UPDATE 2

Never mind, once I add the fix to the right place, it does actually work (changing “10” to “130”). Now I’ve got to make it “smart” in that it will take into account previous printing areas and always print subsequent lines below the starting point + height of prior printings.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:22:35+00:00Added an answer on June 18, 2026 at 3:22 pm

    It look’s like you’re writing CPCL directly to the printer. The TEXT command that you are using includes x and y coordinates itself in the command – namely, the ’30’ and ’40’ that you are writing is telling your printer to always print each line of text at the coordinates 30,40. Try changing these coordinates with each subsequent line of text that you want to print. To my knowledge, there is no ‘auto-wrap’ feature for CPCL, so you will have to do this manually for each line of text.

    Alternatively, you can put the printer in line-print mode. In this mode, the printer will simply print any text that it receives, and ‘\r\n’ will cause the printer to start printing on the next line. You can toggle line print mode by sending the following command to the printer:

    ! U1 setvar “device.languages” “line_print” [NEW LINE CHARACTER HERE]

    source: CPCL Manual – http://www.zebra.com/content/dam/zebra/manuals/en-us/printer/cpcl-pm-en.pdf

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

require 'coderay' puts CodeRay.scan('puts Hello, world!', :ruby).page This code will print full HTML page
Although I know there are hundreds of posts in stackoverflow regarding this post still,
This will probably make me look lame but still -- I can't find any
this question is from Codechef.com [if anyone is still solving this question dont look
This will hopefully be a simple one: I have a div I want to
[This will only make sense if you've seen Kevin Smith's 'Erlang in Practice' screencasts]
This will probably be obvious but I can't find the best way. I want
This will be probable quite odd question. But i thought I will give it
This will be implemented in Javascript (jQuery) but I suppose the method could be
This will be a bit subjective, I'm afraid, but I'd value the advice of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.