Results 1 to 4 of 4

Thread: barcode

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    114

    barcode

    I am using barcode 39 but the barcode is too long horizontally(left and right) for my label so what I need to do is figure out how to shorten the barcode without changing the data that is strored in the barcode. I think I can do this by changing the density of the barcode but I don't know how to do this. Can anyone help me with this?

    Here is my code:

    Dim sValidChars As String
    Dim sValidCodes As String
    Dim lElevate As Integer
    Dim lCounter As Long
    Dim lWkValue As Long
    Dim PosX As Long
    Dim PosY1 As Long
    Dim PosY2 As Long
    Dim TPX As Long
    Dim xMiddle As Single

    ' pPaintInto.Cls

    TPX = 15 'Screen.TwipsPerPixelX

    sValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"
    sValidCodes = "41914595664727860970419025962647338417105957" + _
    "84729059950476626106644590602984801043246599" + _
    "62476744460260046477586109044686603224803443" + _
    "91860130478424477058030365265828235758580903" + _
    "65863556658042365383495434978353624150635770"

    sToCode = UCase(IIf(Left(sToCode, 1) = "*", "", "*") + sToCode + IIf(Right(sToCode, 1) = "*", "", "*"))
    PosX = (rX1 + (rX2 - rX1) / 2) - (((Len(sToCode) * 16) / 2) * TPX) - 1
    ' PosX = ((((pPaintInto.Width / TPX) - (Len(sToCode) * 16)) / 2) * TPX) - 1
    ' PosY1 = pPaintInto.Height * 0.2
    ' PosY2 = pPaintInto.Height * 0.8



    ' If PosX < 0 Then
    ' MsgBox "The length of the code exceeds control limits.", vbExclamation, "Large string"
    ' GoTo End_Code
    ' End If

    On Error Resume Next


    'PosX = rX1
    For lCounter = 1 To Len(sToCode)
    'Here is where the number is fetched fro
    ' m the sValidCodes string. It will get on
    ' ly 5 digits.
    lWkValue = Val(Mid(sValidCodes, ((InStr(1, sValidChars, Mid(sToCode, lCounter, 1)) - 1) * 5) + 1, 5))
    lWkValue = IIf(lWkValue = 0, 36538, lWkValue)


    For lElevate = 15 To 0 Step -1
    'It evaluates the binary number to see i
    ' f it has to draw a line.


    If lWkValue >= 2 ^ lElevate Then
    ' pPaintInto.Line (PosX, PosY1)-(PosX, PosY2)
    vspCurrent.DrawLine PosX, rY1 + 0.05 * TPI, _
    PosX, RY1+rBarHeight
    lWkValue = lWkValue - (2 ^ lElevate)
    End If
    PosX = PosX + TPX
    Next
    Next
    ' pLabelInto.caption = Mid(sToCode, 2, Len(sToCode) - 2)
    End_Code:

  2. #2
    jim mcnamara
    Guest
    Since you're printing barcode your printer driver can support the
    Printer.Zoom method. You use this method to scale down the size of the object output on paper.

    We've used it on five or six different barocde projects.

    Also, barcodes are usually supplied as TrueType fonts. You can
    simply change the font size from say 10 to 9.

    The printer object supports fontsize, also.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2000
    Posts
    114
    I guess I am not using any font because drawing lines is basically what I am doing and changing the font doesn't change anything. This is a barcode font free routine....

  4. #4
    Lively Member dbarr's Avatar
    Join Date
    Oct 2001
    Location
    Syracuse, NY
    Posts
    86

    Guess

    To me it looks as if you change yor TPX value, it will have an immediate effect on your density. if change other values you may change the ratios associated with wide bars and narrow bars. That would be a bad thing. Hope this helps.

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