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

asked on

VB2013 Code does not recognize hieght of a label

Hello Experts,
The following vb2013 code prints ONE label ans stays right where the last line was printed,
How can I make it jump to the next label ?
not leave a whole blank label, but just go to next label.

Right now its not leaving a blank label, just stays in the las printed line and does not jump to the beggining of the next label. which is what I need order to send the next label with different data.

Regards,



Imports STROKESCRIBELib

Public Class Form1

    'Button1 starts printing of a single-page document with barcode.
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim pd As New Printing.PrintDocument
        pd.PrinterSettings.PrinterName = "ZDesigner GC420d (EPL)" '-- Uncomment this to select a specific printer.

        AddHandler pd.PrintPage, AddressOf PrintHandler
        pd.Print()
        RemoveHandler pd.PrintPage, AddressOf PrintHandler
    End Sub

    'This Sub constructs a printable page.
    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 = "1234ABCD" 'This text will be stored in the barcode.

        Dim img As Image
        img = barcode.GetPictureHandle(enumFormats.EMF, 30, 15) 'Generates a barcode picture, 50x30mm.
        If barcode.Error Then
            MsgBox(barcode.ErrorDescription)
            Return
        End If

        Dim ag = args.Graphics

        ag.PageUnit = GraphicsUnit.Millimeter
        ag.DrawString("1234567890QWERTYUIOP1234567890XZCVBNMNBV", New Font("Arial", 8), Brushes.Black, 0, 1) 'A text label near the barcode
        ag.DrawString("1234567890QWERTYUIOP1234567890XZCVBNMNBV", New Font("Arial", 8), Brushes.Black, 0, 4)
        ag.DrawString("1234567890QWERTYUIOP1234567890XZCVBNMNBV", New Font("Arial", 8), Brushes.Black, 0, 7)
        ag.DrawImage(img, 1, 10) 'Position of the left-top corner of the barcode relatively to the left-top corner of the page (millimeters).

        args.HasMorePages = False 'We print only one page each time the Button1 is pressed.
    End Sub
End Class

Open in new window

Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Do you want to print many copies of the same label, or print different information on each label?

Are you printing on label sheets that have many columns or on a 1 column label printer?
Avatar of RGuillermo

ASKER

Jacques.
I am printing in a one column label zebra printe GC420d
and most of the time I need to print diferente labels.
But at the end of the month I may need to repeat a few labels almost a hundres copies.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada 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
thank you Jacques,
That was clear enough
If you have time send me a Little code just in case,