Results 1 to 4 of 4

Thread: help Printing in a label printer

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2016
    Posts
    2

    help Printing in a label printer

    Good day to all, i come here with a question that possibly is very easy to answer but i am new on this and do not find it anywhere on the net.

    i want to print using code in visual basic 2010, but i'm having a hard time because the printing is not being made into a conventional A4 paper sheet but instead in a label with size length = 28mm x height = 88mm.

    i know from what i've read that i need to use the e.graphics.drawimage() or e.graphics.drawstring() to achieve this, this is what i have done.

    this is the desired result.
    Name:  dpi problem 01.jpg
Views: 409
Size:  20.6 KB

    i did this label on photoshop with a DPI of 200, giving me an image size of what the picture shows
    Name:  dpi problem 00.png
Views: 444
Size:  23.2 KB

    now this is my code, i just have the code so that it prinst me out the bluestreak logo

    ' i need to configure the page so it prints in landscape so i can print on the long side of the label
    Dim PageSetup As New PageSettings
    With PageSetup
    .Landscape = True

    End With
    PrintDocu.DefaultPageSettings = PageSetup
    PrintDocu.Print()

    'Now i print out an image on the left half of the label
    Private Sub PrintDocu_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocu.PrintPage

    Dim image1 As Image = Image.FromFile("C:\ABS_Reader\Resources\335x122.png")
    e.Graphics.DrawImage(image1, 7, 49, 335, 122)

    with the above code when i print the picture comes out cropped as shown in the picture below.
    Name:  dpi problem 02.jpg
Views: 379
Size:  11.8 KB

    also reading around the internet found out that possibly my problem is that VB is printing out the default DPI = 96DPI, i really don't know.... but if this really the case, is there a way to adjust the printout to adjust to my 200DPI?, my label printer supports up to 300DPI on the print head...
    Name:  dpi problem 03.jpg
Views: 381
Size:  32.5 KB

    hope you can guide me to the correct path.

    Best regards and thanks for advanced.

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,712

    Re: help Printing in a label printer

    Sometimes when I get into a situation when things are not what I would expect I'll make a change that should have predictable result. Something simple like changing the image size arguments to the drawImage method for example. If the image is printing about twice as wide and twice as big, then maybe printing it half the size will help. Then take that result and compare it to other things. 96 dpi is about half of 200 dpi so maybe that is the key... I wish I knew enough about printing to give you a definitive answer, but that's all I got.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,191

    Re: help Printing in a label printer

    Quote Originally Posted by omegads View Post
    Good day to all, i come here with a question that possibly is very easy to answer but i am new on this and do not find it anywhere on the net.

    i want to print using code in visual basic 2010, but i'm having a hard time because the printing is not being made into a conventional A4 paper sheet but instead in a label with size length = 28mm x height = 88mm.

    i know from what i've read that i need to use the e.graphics.drawimage() or e.graphics.drawstring() to achieve this, this is what i have done.
    That's certainly NOT the way I would do it. I would be using the printer's command language to print the label. I have never seen a label printer (ie, Intermec, Sato, Zebra) that came without one. Typically there are commands to download the format and/or graphics and a command to populate that format with data. Sometimes they are the same. So you should find the programming manual for your printer model.

    For example, this is what I send to a Zebra to print some barcodes and text (the words encased in $ are my own placeholders that my code replaces with the actual data):
    CT~~CD,~CC^~CT~
    ^XA~TA100~JSO^LT0^MNN^MTT^PON^PMN^LH0,0^JMA^PR2,2~SD30^JUS^LRN^CI0^XZ
    ^XA
    ^MMT
    ^PW1200
    ^LL1200
    ^LS0
    ^FT1125,800^A0I,83,81^FH\^FD$DESC1$^FS
    ^FT1125,750^A0I,42,43^FH\^FD$DESC2$^FS
    ^FT1125,660^A0I,42,43^FH\^FDMO: $PO$^FS
    ^FT1125,605^A0I,42,43^FH\^FD$CUST$^FS
    ^FT1125,550^A0I,42,43^FH\^FD$LOTNUM$^FS
    ^FT1125,495^A0I,42,43^FH\^FDMFG DATE: $MFGDATE$^FS
    ^FT1125,375^A0I,120,120^FH\^FD$PLU$^FS
    ^FT445,400^BXI,10,200,0,0,1,_,1
    ^FH\^FD$MATRIX$^FS
    ^FT890,60^A0I,47,45^FH\^FD(91)$GTIN$^FS
    ^BY6,3,160^FT1125,120^BCI,,N,N,N,D
    ^FD(91)$GTIN$^FS
    ^PQ1,0,1,Y^XZ
    Here is one for a Sato (without any graphics to keep it short):
    A*ZACC2*F,008YS,008/Y,COLabel8 FDA FR%3H0161V0503P05RDB00,038,085,LBS%3H0164V0029P05RDB00,026,081,NET WT.%3H0288V0035P05RDB00,021,047,KEEP
    REFRIGERATED OR FROZEN%3H1105V0032P05RDA00,033,034,LOT%3H1065V0032P05$A,030,034,0$=USE OR FREEZE BY:%3H1164V0738P05$A,024,030,0$=SOME CITY, CO
    12345%3H1172V0032P05$A,079,055,8$=COMPANYNAME%0H0450V0027FW09V0948%3H0287V0740P05RDB00 ,021,025,8/N,06,27%3H0856V0640P05$A,024,030,0$=empty/N
    ,02,27%3H1016V0032P05$A,069,059,0$=empty/N,05,27%3H0858V0024P05$A,024,030,0$=empty/N,04,27%3H0899V0032P05$A,059,034,0$=empty/N
    ,03,27%3H0959V0032P05$A,069,059,0$=empty/N,18,46%3H0327V0033P05RDB00,033,034,empty/N,15,08%3H0230V0624L0101P05Sempty/N
    ,09,05%3H0243V0195P05$A,108,163,0$=empty/N,10,06%3H1105V0132P05RDA00,033,034,empty/N,01,05%3H0289V0760P05$A,128,214,0$=empty/N
    ,21,05%3H1126V0410P05$A,167,112,0$=empty/N,10,06%3H0199V0629L0101P05Sempty/N,08,04%3H0289V0632P05RDB00,019,029,empty/N
    ,36,57%3H0489V0022L0101P05XSempty/N,35,57%3H0526V0022L0101P05XSempty/N,34,57%3H0563V0022L0101P05XSempty/N,33,57%3H0599V0022L0101P05XSempty/N
    ,32,57%3H0636V0022L0101P05XSempty/N,31,57%3H0672V0022L0101P05XSempty/N,30,57%3H0709V0022L0101P05XSempty/N,29,57%3H0746V0022L0101P05XSempty/N
    ,28,57%3H0782V0022L0101P05XSempty/N,27,57%3H0819V0022L0101P05XSempty/N,25,05%3H0140V0663L0101P05XSempty/N,23,08%3H0261V0614L0101P05Sempty/N
    ,14,07%3H0169V0628L0101P05Sempty/N,11,03%3H0112V0635L0101P05Sempty/N,17,52%3H0446V0033BG03113/N,40,01%3H0424V1005P02$A,079,059,0$=emptyZ

  4. #4
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    1,849

    Re: help Printing in a label printer

    See if this link helps any...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width