Link to home
Start Free TrialLog in
Avatar of RGuillermo
RGuillermoFlag for United States of America

asked on

HOW TO USE ZPL PRINTER

Hello Experts,
Our zebra GC420T is in a remote location
so we cant really see what it prints.

I got this link from another expert, it is supposed to let me have a preview print locally..
https://chrome.google.com/webstore/detail/zpl-printer/phoidlklenidapnijkabnfdgmadlcmjo/support

I have downloaded and installed but cant print anything to that simulator.
its free...
Can anyone tell me how to use it ?

regards,
Avatar of akb
akb
Flag of Australia image

You need to run the app and leave it open on your screen.
Then go into Devices & Printers in Control Panel. Add a printer. Select Add a Local Printer.
Create a new port - Standard TCP/IP.
Use IP 127.0.0.1
Let Windows detect the port and it will eventually return an error.
Select Device Type -> Custom.
Press settings and make sure you have IP Address 127.0.0.1, Protocol RAW and port 9100.
Click OK and Next.
Wait for it to fail to detect driver model.
Select Generic and Generic/Text Only.
Next a few times then Name your printer.

Open Notepad and copy the following lines to Notepad:

^XA
^CF0,36,42
^FO30,40 ^A0,44,50 ^FDTEST^FS
^FO30,100 ^FDBag Number:^FS
^XZ


Now print the Notepad to the new printer you created and you should see a label appear in the ZPL Printer App.
Avatar of RGuillermo

ASKER

akb
I was able to print text from notepad. thank you very much
now this is a very small source code that Works just fine on the real zebra printer,
but in the zpl printer only shows a blank label

Is there any way I can get to print my labels?
Regards

Imports System.IO
Imports STROKESCRIBELib
Public Class Form1
    Public MyFileName As String
    Dim w_pro_cod As String, w_bar_cod As String, w_pro_des As String, w_uni_pri As String, w_exp_dat As String, w_qty As String
    Dim pd As New Printing.PrintDocument

    Private Sub form1_load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim a As Integer
        'ZDesigner GC420d (EPL)       -------       Zpl Printer
        pd.PrinterSettings.PrinterName = "Label Printer" '-- Uncomment this to select a specific printer.
        AddHandler pd.PrintPage, AddressOf PrintHandler

        READ_DATA_01()
        For a = 1 To Val(w_qty)
            pd.Print()
        Next a
        RemoveHandler pd.PrintPage, AddressOf PrintHandler
        End
    End Sub

    Private Sub PrintHandler(ByVal sender As Object, ByVal args As Printing.PrintPageEventArgs)
        Dim barcode = AxStrokeScribe1 'This name is assigned to the barcode ActiveX by default.'To check which name the ActiveX actually has, select the ActiveX, press Alt-Enter and look for the Design group in the Properties box.
        barcode.Alphabet = enumAlphabet.CODE128 'Change this to produce barcode of the desired type.
        barcode.CtlText = w_bar_cod 'This text will be stored in the barcode.

        Dim img As Image, x As Integer = -2, y As Integer = 0, ph As Integer = 45, v0 As String, v1 As String, v2 As String
        img = barcode.GetPictureHandle(enumFormats.EMF, 31, 12) 'Generates a barcode picture, 50x30mm.
        If barcode.Error Then
            MsgBox(barcode.ErrorDescription)
            Return
        End If

        Dim ag = args.Graphics
        Dim xx = args.PageSettings

        ag.PageUnit = GraphicsUnit.Millimeter
        ag.DrawString(Space(10) & "Botica Paradera", New Font("Arial Narrow", 8), Brushes.Black, x, y + 0.5) 'A text label near the barcode
        v0 = Trim(w_pro_des) + Space(50)
        v1 = Mid(v0, 1, 20)
        v2 = Mid(v0, 21, 7)
        ag.DrawString(v1, New Font("Arial Narrow", 8), Brushes.Black, x + 2, y + 3)
        ag.DrawString(v2, New Font("Arial Narrow", 8), Brushes.Black, x + 2, y + 6)
        'ag.DrawString(w_exp_dat, New Font("Arial Narrow", 7), Brushes.Black, x + 2, y + 9)
        ag.DrawString("F/ " & w_uni_pri, New Font("Arial", 12), Brushes.Black, x + 7, y + 6)
        ag.DrawImage(img, x + 1, y + 11) 'Position of the left-top corner of the barcode relatively to the left-top corner of the page (millimeters).
        'ag.DrawString("*******", New Font("Arial", 9), Brushes.Black, x, y + 20)
        args.HasMorePages = False 'We print only one page each time the Button1 is pressed.
    End Sub

    Private Sub READ_DATA_01()
        Dim fields() As String, w As String
        MyFileName = "c:\tmp\barcode_label.csv"
        FileOpen(1, MyFileName, OpenMode.Input)
        w = Trim(RTrim(LineInput(1)))
        w = Trim(RTrim(LineInput(1)))
        FileClose(1)
        fields = Split(w, ",")
        w_pro_cod = fields(0)
        w_bar_cod = Replace(fields(1), Chr(34), "")
        w_pro_des = Replace(fields(2), Chr(34), "")
        w_uni_pri = fields(3)
        w_exp_dat = Replace(fields(4), Chr(34), "")
        w_qty = fields(5)
    End Sub

End Class
Unfortunately I can't help you with the code.
Did you print to the Generic printer you created?
Can you set up a new Generic Text printer and use your program to print to a text file?
If you post the text file here I can try sending that to my ZPL printer and we can see what happens.
akb
I thnak you very much for your interest,
attached you will find the .PRN file.
test1.prn
ASKER CERTIFIED SOLUTION
Avatar of akb
akb
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you very much for your guidance, my ports were not right, now I am previewing my labels.
Seems visual basic has its own way of doing things regarding labels. Just cant tell what exactly.
.
Now following your ideas I was sucessfull using visual basic and printing previews using BULLZIP printer and getting the labels as preview in PDF documents.

Works for me. Now we can continue with our job.

Best Regards!!