0

I have been given a Vb.Net Bar code program written by former developer in VS 2008 VB.Net. I have been tasked to add another field( Date Received) generating the barcode. I have included the field. The print preview shows the Date received date itself. It's not generating any bar code. The problem is , It is not generating the bar code for any of the other fields also which was coded earlier..

  1. I have downloaded the font 3 of 9
  2. I have included the * in the beginning and end of the filed to generate barcode.

I have added all the libraries needed.( System,Drawing, text, Printing)`
Can you please point me ways to debug, why it is not generating the BARCODE? Snippet of the code:

 DateReceived = Mid$(lines(10), 23, 10)
 DateReceivedBC = "*" & DateReceived & "*"
 printFont = New Font("3 of 9 Barcode", 20)
 printFont2 = New Font("arial", 12)
 printFont3 = New Font("arial black", 18)

 ev.Graphics.DrawString("Date Recieved", printFont6, Brushes.Black, 375, 940, New StringFormat)
 ev.Graphics.DrawString(DateReceivedBC, printFont, Brushes.Black, 345, 950, New StringFormat)
 ev.Graphics.DrawString(DateReceived, printFont2, Brushes.Black, 375, 975, New StringFormat)

  Dim pd As New PrintDocument
        AddHandler pd.PrintPage, AddressOf Me.pd_PrintPage
        '
        'set printer
        'Empl = pd.PrinterSettings.DefaultPageSettings.PaperSource.SourceName()
        '
        'MessageBox.Show(Empl)
        pd.DocumentName = Empl & "  Bar Code Sheets"

        pd.PrinterSettings.PrinterName = PrinterName

        pd.PrinterSettings.Copies = 1
        'print
        PrintPreviewDialog1.Document = pd

It looks like this in the image , when i try to print out : printoutput

Peter Hull
  • 6,683
  • 4
  • 39
  • 48
SaraDob
  • 77
  • 11
  • You are drawing a string **not barcode**, that will **never** generate a barcode... You need special fonts and or a library... – Trevor Jul 26 '17 at 17:16
  • I have added 3 of 9 Font. – SaraDob Jul 26 '17 at 17:49
  • im Following this instruction:https://stackoverflow.com/questions/1998209/how-to-generate-barcode-from-a-string-using-c – SaraDob Jul 26 '17 at 18:09
  • 1
    Make sure you have the font-name right, if it's printing that way it's because the system couldn't find a font with the name you gave New Font() so it just reverts to a default. When I installed 3 of 9 on my pc a long time ago, I had to call it by New Font("Free 3 of 9", 30) for the name to resolve, so check yours and make sure you're using the correct name your registry has for that font – soohoonigan Jul 26 '17 at 19:04
  • We are using the same font here aswell. We noticed that font needs to be installed correctly on the client PC as on the server for it to work. Otherwise you won't ever see the generated barcode – User999999 Jul 27 '17 at 07:37
  • @soohoonigan, You were so right. the font was named as Free 3 0f 9 Extended.Thank you for the tip.@User999999, i was wondering why it was printing right on other workstation and not few. Thank you – SaraDob Jul 28 '17 at 14:31

0 Answers0