Skip to Content
Author's profile photo Bruno Xavier

Convert Image BMP Monochrome to Zebra ASCII Hex representation (ZPL code)

English translation, in the second part. Screens of the operating system could not translate.

 
Portuguese Version:

Esse blog compartilha uma experiência legal.

1. Download ZebraDesigner v2.2.3.4271 (instale sem nenhum custo).

2. Salve a imagem em Bitmap monocromático no MSPAINT Windows.
/wp-content/uploads/2013/08/zebra1_255169.jpg
3. Resultado Esperado
/wp-content/uploads/2013/08/zebra2_255170.jpg

4. Configure a impressão para Arquivo.

          Propriedades da impressora no Painel de Controle do Windows
          /wp-content/uploads/2013/08/zebraa3_255172.jpg

          Clique em Adicionar Porta
          /wp-content/uploads/2013/08/zebra4_255176.jpg    

          Clique em Nova Porta    
           /wp-content/uploads/2013/08/zebra5_255177.jpg

         
          Escolha um caminho para o arquivo TXT    
           /wp-content/uploads/2013/08/zebra6_255182.jpg
          Clique em Fechar
          /wp-content/uploads/2013/08/zebra7_255183.jpg

          Clique em Aplicar
          /wp-content/uploads/2013/08/zebra8_255184.jpg
5. ZebraDesigner- Importe a imagem
/wp-content/uploads/2013/08/zebra9_255185.jpg

6. Imprima para Arquivo
          Menu: File->Print…

/wp-content/uploads/2013/08/zebra10_255186.jpg        
     Clique em Print
/wp-content/uploads/2013/08/zebra11_255187.jpg

7. Abra o arquivo gerado output.txt
/wp-content/uploads/2013/08/zebra12_255188.jpg

     Comandos ~DG (Download Graphics) e XG (Recall Image) foram gerados.

/wp-content/uploads/2013/08/zebra13_255189.jpg
8. Código ABAP utilizado na ocasião apenas para teste:


Feito upload do código OUTPUT.TXT na transação SO10 (Standard Text) com o nome ZLOGO_PRINT, passo não mostrado nesse blog.

REPORT  zebra.
PARAMETERS: p_print TYPE itcpp-tddest DEFAULT 'LOCL'.
DATA: t_lines TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <f_lines> LIKE LINE OF t_lines.
START-OF-SELECTION.
  NEW-PAGE PRINT OFF.
  NEW-PAGE
    NO-TITLE
    NO-HEADING
    LINE-SIZE  90
    LINE-COUNT 665
    PRINT ON NO DIALOG
    IMMEDIATELY   'X'
    KEEP IN SPOOL ' '
    NEW LIST IDENTIFICATION ' '
    DESTINATION p_print
    COPIES 1.
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                         = 'ST'
      language             = 'P'
      name                   = 'ZLOGO_PRINT'
      object                  = 'TEXT'
    TABLES
      lines                    = t_lines
    EXCEPTIONS
      id                         = 1
      language             = 2
      name                   = 3
      not_found            = 4
      object                   = 5
      reference_check  = 6
      wrong_access_to_archive = 7
      OTHERS                           = 8.
  IF sy-subrc = 0.
    LOOP AT t_lines ASSIGNING <f_lines>.
      WRITE / <f_lines>-tdline.
    ENDLOOP.
  ENDIF.
  NEW-PAGE    PRINT OFF.
9. Referência:
10. Link Adicionais:
11. Agradecimentos:
          Henrique Guedes: trouxe a oportunidade de trabalhar com as Logos e ajudou nos testes.
          Marllon Antunes   : Instalou a impressora ZM400 para testes reais.
          Marcio Gardezani: forneceu a valiosa dica do ZTOOLS/MSPAINT e posteriormente comentou sobre a opção de imprimir TXT pelo ZebraDesigner.
          Sávio Barbosa     : ajudou nos casos reais no ambiente produtivo.
          .

English Version:
This blog shares a cool experience.
1. Download ZebraDesigner v2.2.3.4271 (install at no cost).
2. Save the image in Bitmap Monochrome in MSPAINT Windows.

/wp-content/uploads/2013/08/zebra1_255169.jpg
3. Expected Result

/wp-content/uploads/2013/08/zebra2_255170.jpg
4. Configure Printer to File

     Properties of the printer in the Windows Control Panel

     /wp-content/uploads/2013/08/zebraa3_255172.jpg

          Click add port
          /wp-content/uploads/2013/08/zebra4_255176.jpg           

          Click new port 
           /wp-content/uploads/2013/08/zebra5_255177.jpg

         

          Choose a path to the TXT file

             /wp-content/uploads/2013/08/zebra6_255182.jpg

          Click Close
          /wp-content/uploads/2013/08/zebra7_255183.jpg

          Click Apply
          /wp-content/uploads/2013/08/zebra8_255184.jpg
5. ZebraDesigner- Import the image
/wp-content/uploads/2013/08/zebra9_255185.jpg
6. Print to File
          Menu: File->Print…

         /wp-content/uploads/2013/08/zebra10_255186.jpg
     Click Print
/wp-content/uploads/2013/08/zebra11_255187.jpg

7. Open generated file output.txt
/wp-content/uploads/2013/08/zebra12_255188.jpg
     Commands ~DG (Download Graphics) e XG (Recall Image) were generated.
/wp-content/uploads/2013/08/zebra13_255189.jpg
8. ABAP code used on occasion just to test:


Uploaded code OUTPUT.TXT in transaction SO10 (Standard Text) with name ZLOGO_PRINT, step not shown in this blog.

REPORT  zebra.
PARAMETERS: p_print TYPE itcpp-tddest DEFAULT 'LOCL'.
DATA: t_lines TYPE STANDARD TABLE OF tline.
FIELD-SYMBOLS: <f_lines> LIKE LINE OF t_lines.
START-OF-SELECTION.
  NEW-PAGE PRINT OFF.
  NEW-PAGE
    NO-TITLE
    NO-HEADING
    LINE-SIZE  90
    LINE-COUNT 665
    PRINT ON NO DIALOG
    IMMEDIATELY   'X'
    KEEP IN SPOOL ' '
    NEW LIST IDENTIFICATION ' '
    DESTINATION p_print
    COPIES 1.
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      id                         = 'ST'
      language             = 'P'
      name                   = 'ZLOGO_PRINT'
      object                  = 'TEXT'
    TABLES
      lines                    = t_lines
    EXCEPTIONS
      id                         = 1
      language             = 2
      name                   = 3
      not_found            = 4
      object                   = 5
      reference_check  = 6
      wrong_access_to_archive = 7
      OTHERS                           = 8.
  IF sy-subrc = 0.
    LOOP AT t_lines ASSIGNING <f_lines>.
      WRITE / <f_lines>-tdline.
    ENDLOOP.
  ENDIF.
  NEW-PAGE    PRINT OFF.

10. Additional Links:
11. Thanks:
          Henrique Guedes: brought the opportunity to work with the Logos and helped in testing.
          Marllon Antunes  : Installed the printer ZM400 for real testing.
          Marcio Gardezani: provided a valuable tip from ZTOOLS/MSPAINT and later commented on the option to print TXT by ZebraDesigner.

          Sávio Barbosa     : helped in cases in real production environment.

Assigned tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.