17 Replies Latest reply on Jun 19, 2018 8:25 AM by mahmoud zahran

    How to Print a .txt File Data.

    mukesh vaishnav

      Hello Sir/Medam,

      Can you Please Guide me for print a .txt file data with the help of Zebra zt 230 standard

       

      Thanks

      Daulat Singh

      daulatsingh08@gmail.com

        • Re: How to Print a .txt File Data.
          Robin West

          Hi Daulat,

          Are you trying to print the contents of the text file as text, or does your text file have printer language? 

          Are you wanting to print it from a PC, Android, or iOS device? 

          How are you connecting to the printer?

            • Re: How to Print a .txt File Data.
              mukesh vaishnav

              Dear Robin,

                              many thanks for support and suggestion

              Q. Are you trying to print the contents of the text file as text, or does your text file have printer language?

              Ans : Use Printer Language while using Argox printer, now replace this printer so enhances\ changes in my development.

               

              Q .  Are you wanting to print it from a PC, Android, or iOS device?

              Ans : PC, USB printer is connected in my PC .

               

              Problem Description :

               

                am trying to print a WMIF.txt file that was written in printer language  according to last printer (Agrox ) but now replace this printer by Zebra and useing desktop application that is developed in C# language. i want to print from my PC  Usb Printer (Zebra zt 230 standard (203) dpi barcode printer with usb interface not LPT (parallel port))is connected also.

              Also enclosed my development Snaps.

               

              AgroxPrinter.PNGAgroxPrint-2.PNG

                         

                          pls Suggest me best way for print Csv file.

               

               

              Thanks.

              Daulat Singh.

              • Re: How to Print a .txt File Data.
                jofin george

                Hi Robin,

                 

                I too have the same question but from a different platform (IOS). I am trying to print .txt file having printer language (CPCL) VIA bluetooth.

                Please give me some sample code to print this kind of file.

                  • Re: How to Print a .txt File Data.
                    jofin george

                    Hi Robin,

                     

                    I have an urgent requirement to convert image or pdf file used for printing in zebra imz320 printer  to cpcl format. can you please help me on this with some sample code.

                    My requirement

                    Image.png/image.jpg/imf.pdf   ----- > content.txt (this contain cpcl commands converted from image or pdf file eg : ! 0 200 200 210 1 TEXT 4 0 30 40 Hello World FORM PRINT )

                     

                    Any help is appreciated

                     

                    Thanks

                    Jofin

                      • Re: How to Print a .txt File Data.
                        Robin West

                        Hi Jofin,

                        The easiest way is to use the Link-OS Multiplatform SDK | Zebra 

                        Documentation and a short sample on printing graphics is here: Link-OS SDK - Zebra Technologies Techdocs

                        I also posted a discussion on PDF printing via iOS here:Re: Generate PDF Document from android/iOs using Zebra iMZ320 spool

                        Robin

                          • Re: How to Print a .txt File Data.
                            jofin george

                            HI ROBIN,

                             

                            I have an urgent requirement to convert image or pdf file used for printing in zebra imz320 printer  to cpcl format. can you please help me on this with some sample code.

                            My requirement

                            Image.png/image.jpg/imf.pdf

                            • Re: How to Print a .txt File Data.
                              jofin george

                              HI

                              ANY UPDATE ON IMAGE TO CPCL CONVERSION BRIEFED BELOW

                               

                              I have an urgent requirement to convert image or pdf file used for printing in zebra imz320 printer  to cpcl format. can you please help me on this with some sample code.

                              My requirement

                              Image.png/image.jpg/imf.pdf   ----- > content.txt (this contain cpcl commands converted from image or pdf file eg : ! 0 200 200 210 1 TEXT 4 0 30 40 Hello World FORMPRINT )

                               

                              Any help is appreciated

                               

                               

                               

                                • Re: How to Print a .txt File Data.
                                  Robin West

                                  Hi Jofin,

                                  Please take a look at my post above.  I believe those links should get you the information you are looking for.  The SDK has basic sample code and documentation for printing images.  The other linktalks about how to work with PDF documents.

                                  Robin

                                    • Re: How to Print a .txt File Data.
                                      jofin george

                                      Hi Robin,

                                       

                                      Thank you for the reply.

                                      I checked your post, but that I have already done, I am able to print images and pdf files, but now my goal is to convert image or pdf file to CPCL format which in turn will be .txt file which contains all the CPCL codes to be printed. for example  this is the CPCL commands to print hello word ! 0 200 200 210 1 TEXT 4 0 30 40 Hello World FORMPRINT like this, will I be able to convert pdf/ image file to this format using IOS/objective-c

                                      Hope You got my point

                                       

                                      Thanks

                                      Jofin

                                      • Re: How to Print a .txt File Data.
                                        jofin george

                                        Hi Robin,

                                         

                                        Thank you for the reply.

                                        I checked your post, but that I have already done, I am able to print images and pdf files, but now my goal is to convert image or pdf file to CPCL format which in turn will be .txt file which contains all the CPCL codes to be printed. for example  this is the CPCL commands to print hello word  ! 0 200 200 210 1 TEXT 4 0 30 40 Hello World FORMPRINT like this, will I be able to convert pdf/ image file to this format using IOS/objective-c

                                        Hope You got my point

                                         

                                        Thanks

                                        Jofin

                                        • Re: How to Print a .txt File Data.
                                          jofin george

                                          Hi Robin,

                                           

                                          Any update on this.

                                            • Re: How to Print a .txt File Data.
                                              Robin West

                                              Hi Jolfin,

                                              I'm trying to understand.  If you have a image or PDF with text and barcodes, there is no easy way to convert the text and barcodes into CPCL directly.  You can take these images and convert them into a PCX format that can be part of a text file that can be sent directly to the printer.  I think you will need a third party library to convert to PCX if you really want to store it as a file. 

                                              Our own SDK does the conversion, but it sends it directly to the printer and does not give you a string to store as a file.  Usually we recommend using storeImage() to save the image to the printer, then you can send the CPCL directly or from a file to print it.  See the  ZSDK - iOS with PCX images.  post.

                                              Does this answer your question?

                                              Robin

                                                • Re: How to Print a .txt File Data.
                                                  jofin george

                                                  Hi Robin,

                                                   

                                                  I am able to take pdf file print out on my iMZ320 zebra printer, but it is printing in reverse direction means upside down way. Can you help me how to make it in normal way which is similar to the print coming from zebra utilities app. I am using objective c code so please give some sample codes in same language.

                                                  • Re: How to Print a .txt File Data.
                                                    jofin george

                                                    Hi Robin,

                                                    Do you have any update on my above query.

                                                    • Re: How to Print a .txt File Data.
                                                      mahmoud zahran

                                                      you can see this link is describe  what the problem exactly

                                                      https://stackoverflow.com/questions/50795526/print-an-image-and-text-to-receipt-using-cpcl-in-android-mz320-using-android

                                                       

                                                      I tried to print image and text in receipt using Cpcl format like that

                                                      template. I have an example set logo as a variable and use function to read

                                                      the image as string but that image in example is CPCL format I tried a lot

                                                      to get my logo as a cpcl format but i can't so I need to know how to get my

                                                      image logo as cpcl format or another way to set image and text like that

                                                      templete.

                                                       

                                                       

                                                      //this template used to design my ticket which it has image and text

                                                      in the same ticket like what i need.

                                                       

                                                          ! 0 200 200 1050 1

                                                       

                                                          PW 575

                                                       

                                                          TONE 0

                                                       

                                                          SPEED 3

                                                       

                                                          ON-FEED IGNORE

                                                       

                                                          NO-PACE

                                                       

                                                          BAR-SENSE

                                                       

                                                          BT 0 4 6

                                                       

                                                          B 128 3 30 120 20 0 $

                                                       

                                                        
                                                        
                                                      /* the line below is used to set image as a string variable initialized
                                                        in code from image i have in the worked example which its extension
                                                        logo.cpcl" I don't know how it comes? and i need to change new logo to
                                                        Cpcl from png too "newlogo.png -> newlogo.cpcl" "pcx" x, y, data"*/


                                                        PCX
                                                      420 790 ${Logo}

                                                        ML
                                                      32

                                                        T270
                                                      7 0 550 170 ${typeTicket}

                                                        ENDML

                                                        ML
                                                      32

                                                        T270
                                                      7 0 498 170 ${validPeriod}

                                                        ENDML

                                                        ML
                                                      25

                                                        T270
                                                      7 0 446 170 ${park}

                                                        ENDML

                                                        ML
                                                      32

                                                        T270
                                                      7 0 370 170 ${price}

                                                        ENDML

                                                        ML
                                                      25

                                                        T270
                                                      7 0 300 170 ${termsOfUse}

                                                        ENDML

                                                        PRINT

                                                      PrinterUtil.readFormat(context, R.raw.logo));

                                                       

                                                      //this line I use to call the function to read cpcl image!
                                                      //and here we got the image from resources

                                                      result
                                                      = StringUtils.replace(result, "${Logo}", PrinterUtil.readFormat(context, R.raw.logo));


                                                      //this is the code used to read image as a string and it works perfectly with the example.

                                                      public static String readFormat(Context context, int formatRes) {

                                                       
                                                      InputStream is = null;

                                                        
                                                      try {

                                                        is
                                                      = context.getResources().openRawResource(formatRes);

                                                        
                                                      try {

                                                        
                                                      return readString(is);

                                                       
                                                      } catch (IOException e) {

                                                        
                                                      return null;

                                                       
                                                      }

                                                       
                                                      } finally {

                                                        
                                                      if (is != null) {

                                                        
                                                      try {

                                                        is
                                                      .close();

                                                       
                                                      } catch (IOException e) {

                                                       
                                                      }

                                                       
                                                      }

                                                       
                                                      }

                                                      }