Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Printing to a Zebra label printer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Printing to a Zebra label printer

    Hi guys,

    Has anyone managed to print labels on a Zebra lable printer? How did you go about it?

    I have a Zebra LP2844 which uses EPL2 ascii based programming language. I'm using 47mm x 29mm labels.

    So, to print a text string at position 10,10, I would send:-

    chr(10) + "N" + chr(10) + "A10,10,0,1,2,2,N,'Some text'" + chr(10)

    My question is, what would be the best way of sending this ascii string to the printer...? Via an A5 report or label?

    Would I define a session variable when designing the report or label and set it to be equal to the above string?

    Which A5 event would I use to assign the variable?

    Thanks in advance...
    Regards,
    Darren Farmer
    ________________________
    Alpha5V8 Enterprise
    Windows XP Professional
    AMD Turion 64 x2/Athlon 64

    #2
    Re: Printing to a Zebra label printer

    Did you search on Zebra? I saw numerous posts when I did. Not that I know if any of them would answer your specific question, but there is that possibility.

    Lkewise with "send string".
    There can be only one.

    Comment


      #3
      Re: Printing to a Zebra label printer

      Hi Stan,

      Thanks for responding... Yes, I've searched on those. I've read the post by Andy Meer:
      http://msgboard.alphasoftware.com/al...ighlight=zebra ...and this post has a reply from Bill Parker. I've looked at his reply and what he says makes sense and would solve my problem as well.

      The EPL2 programming guide states that the syntax of the "A"scii command is:
      A,P1,P2,P3,P4,P5,P6,P7,"DATA" (The "N" command just clears the buffer ready for printing)

      I've defined a calculated field which includes the required ascii control chars and, the required EPL2 commands and then placed it on the label - the calculated field contains the following:

      sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+product_header->Pr_title+chr(10)

      If I then preview & print the label I see the following displayed in the preview and subsequently printed on the label:

      NA10,10,0,1,2,2,N,A good produ

      It's truncated at the "u" character due to the physical size of the label which I'm okay with, but I don't know why it's not decoding the commands as the preview doesn't show the chr(10) (linefeed char).

      I've tried various combinations of quotes around the product_header->Pr_title bit of the above command as I think it should be enclosed in double quotes when sending the string.

      So I think I have a few issues here:
      1) Not sure if it's the printer not decoding the command or not, as it printing the string "as is". I'll do more investigation on this.
      1) How do I know if the chr(10)'s are being sent to the printer, as it seems as though they are being stripped out before being sent to the printer?
      2) How do I get double quotes around product_header->Pr_title, as it prints product_header->Pr_title without reading the value from the DB table if I enclose it in ""'s?

      Thanks...
      Regards,
      Darren Farmer
      ________________________
      Alpha5V8 Enterprise
      Windows XP Professional
      AMD Turion 64 x2/Athlon 64

      Comment


        #4
        Re: Printing to a Zebra label printer

        2) How do I get double quotes around product_header->Pr_title, as it prints product_header->Pr_title without reading the value from the DB table if I enclose it in ""'s?


        Code:
        sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+"\""product_header->Pr_title+chr(10)"\""
        
        sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+chr(34)+"product_header->Pr_title"+chr(34)+chr(10)
        
        sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+chr(34)+chr(34)+product_header->Pr_title+chr(34)+chr(34)+chr(10)
        
        sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+quote(quote(product_header->Pr_title))+chr(10)
        There can be only one.

        Comment


          #5
          Re: Printing to a Zebra label printer

          Thanks Stan... that's one of my issues sorted :)
          Regards,
          Darren Farmer
          ________________________
          Alpha5V8 Enterprise
          Windows XP Professional
          AMD Turion 64 x2/Athlon 64

          Comment


            #6
            Re: Printing to a Zebra label printer

            Hi Daz,

            Yes I did get this working with alot of help from Stan, I am on vacation in the US until the 28th Aug so I cannot get to my code until then

            Sorry

            Andy

            Comment


              #7
              Re: Printing to a Zebra label printer

              Originally posted by daz_racing View Post
              Thanks Stan... that's one of my issues sorted :)
              Actually I think one of those was wrong

              Code:
              sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+"\""product_header->Pr_title+chr(10)"\""
              should be

              Code:
              sc_title = "N"+chr(10)+"A10,10,0,1,2,2,N,"+"\""+"product_header->Pr_title"+"\""+chr(10)
              There can be only one.

              Comment


                #8
                Re: Printing to a Zebra label printer

                Thanks Stan...that's very diligent of you... as always, your help is much appreciated :)
                Regards,
                Darren Farmer
                ________________________
                Alpha5V8 Enterprise
                Windows XP Professional
                AMD Turion 64 x2/Athlon 64

                Comment


                  #9
                  Re: Printing to a Zebra label printer

                  Andy,

                  Thanks for taking time out of your holiday to respond.

                  My main issue at the moment is to do with the printer not interpreting the command string that I'm sending via A5.

                  If I send a string of chr(10)+"N"+chr(10)+"A10,10..." etc... it prints "NA10,10..." on the label, but at this point, I'm not certain that A5 is actually sending the chr()'s as well as the commands to the printer.

                  My next step is to get the printer to interpret the string I'm sending as a command, so I'll produce a text file manually with chr()'s etc... and COPY it to the printer as per the EPL2 manual to see if that works...and take it from there.

                  Have a good holiday...
                  Regards,
                  Darren Farmer
                  ________________________
                  Alpha5V8 Enterprise
                  Windows XP Professional
                  AMD Turion 64 x2/Athlon 64

                  Comment


                    #10
                    Re: Printing to a Zebra label printer

                    I have done this.

                    First you have to save the report layout to text file using the action script command Save Layout to a file .
                    use xbasic fucntion Sys_print() function to print that text file.
                    I hope this will work

                    Comment


                      #11
                      Re: Printing to a Zebra label printer

                      Hi mujeebur,

                      Many thanks for taking the time to reply. I've just found the time to re-visit this part of my development...

                      I'm still struggling with the fine detail of getting this printer to recognise the commands I'm sending it and I'm not sure if it's Windows/XP/Vista that is stripping out the chr(10) ascii chars or even if the printer is stripping them out of the file I'm sending.

                      Did you change any specific setting of the printer? Such as print direct or something along those lines?

                      Do you think you could give me a slightly more detailed breakdown of what you had to do to get this working and maybe a A5 example of the way you implemented this as all I seem to be able to get it to print is NA10,10,... etc...? - the printer doesn't decode the commands I send.

                      One other question... what interface are you using - USB or LPT?

                      Your help is appreciated as always...

                      Thanks...
                      Regards,
                      Darren Farmer
                      ________________________
                      Alpha5V8 Enterprise
                      Windows XP Professional
                      AMD Turion 64 x2/Athlon 64

                      Comment


                        #12
                        Re: Printing to a Zebra label printer

                        Hi,

                        I hope some one can help me get to the bottom of this problem... there's not far to go to get this sorted (I think )...

                        I'm now in a situation where I know the Zebra printer works, as I have manually typed a text file of the commands as mentioned above to get a label printed and then using "copy test_label.txt lpt1:" at a DOS prompt to print it...all works great when I do this manually.

                        In A5, however, In the Label Editor I've defined a Calculated Field as:

                        sc_title = chr(10)+"N"+chr(10)+"A230,5,0,1,1,1,N,"+chr(34)+trim(product_header->Pr_title)+chr(34)+chr(10)+"P1"+chr(10)

                        ...and placed this field on the label.

                        Next, on the form where I'd like the user to press a button to print the barcode label, I have a push button defined and in the OnPush event I have a "Save a Layout to a File" action as suggested by various other threads on this subject and by mujeebm (above) and a sys_print(file). The problem is, it seems to be saving the commands of the calculated field in a strange format... so, in Notepad, instead of looking like:

                        N
                        A230,5,0,1,1,1,N,"A Good Product"
                        P1

                        (with a chr(10) after each line)

                        ...it actually looks (and prints) like this without decoding the commands:

                        NA230,5,0,1,1,1,N,"A Good Product"P1

                        Saving the layout as a file, seems to be inserting 13 spaces before the "N" and losing the CHR() control characters and I can't figure out why.

                        I feel the Label Editor may be doing something strange with the Calculated Field contents...am I missing some basic setting in the Label Editor perhaps? Something like the "Shrink to fit" option or maybe "Word-Wrap" option of the field?

                        Any ideas???

                        Thanks in advance...
                        Regards,
                        Darren Farmer
                        ________________________
                        Alpha5V8 Enterprise
                        Windows XP Professional
                        AMD Turion 64 x2/Athlon 64

                        Comment


                          #13
                          Re: Printing to a Zebra label printer

                          If your label has a rtf field in which you have placed the calculated field, that could affect the formatting of the output. Try removing the rtf field and place the calculated field directly on the label (drag-drop).
                          There can be only one.

                          Comment


                            #14
                            Re: Printing to a Zebra label printer

                            Hi Stan,

                            Yes, that's what I've done... I dragged and dropped the Calculated Field onto the Label design. However, A5 wants to automatically place a label/prompt for the field as well, so I deleted that, just leaving the calculated field itself on the label design.
                            Regards,
                            Darren Farmer
                            ________________________
                            Alpha5V8 Enterprise
                            Windows XP Professional
                            AMD Turion 64 x2/Athlon 64

                            Comment


                              #15
                              Re: Printing to a Zebra label printer

                              I would try building the string and writing it direct to a file. Some thing like this on your button.
                              Code:
                              sc_title = crlf()+"N"+crlf()+"A230,5,0,1,1,1,N,"+chr(34)+trim(product_header->Pr_title)+chr(34)+crlf()+"P1"+crlf()
                              
                              filename = win_special_folder("desktop")+"\test_label.txt"
                              
                              File.from_string(filename,sc_title)
                              
                              'sys_print(filename)
                              sys_open(filename)
                              Tim Kiebert
                              Eagle Creek Citrus
                              A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                              Comment

                              Working...
                              X