blenkhn Posted April 20, 2012 Share Posted April 20, 2012 I am having an extreme hard time trying to get the barcode font to work and it doesn't seem to want to. I have built this part of my code and when using a barcode reader it doesn't decode. I have tried to use the script by andybiochem and while the barcode prints and decodes fine I can't seem to include it in my script. the space I can use on the page is only 1/2 inch by 4 inches. I grabbed the formula from a site, it must be wrong, please help expandcollapse popupFunc PrintBC ($barcode = "3FAFP31352R159850-D22D0468") ;Build and Print Barcode $bc = StringSplit($barcode, "") $count = 0; For $e = 0 TO UBound($bc) - 1 Local $n = $e + 1 Local $val = Asc($bc[$e]) If $val == 128 Then $val = 0 ElseIf $val >= 33 And $val <= 126 Then $val -= 32 ElseIf $val > 126 And $val <> 128 Then $val -= 50 EndIf $count += ($val * $n) Next Local $rem = Mod($count, 103) If $rem == 0 Then $rem = 128 ElseIf $rem >= 1 And $rem <= 94 Then $rem += 32 ElseIf $rem > 94 And $rem <> 0 Then $rem += 50 EndIf $check = chr($rem) $code = chr(136)&$barcode&$check&chr(138); $DESIREDFONTSIZE = 16 $hFont = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, False, False, False, _ $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Code128bWin') _WinAPI_SelectObject($hPrintDc, $hFont) $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $code) $yTop = $yTop + 70 $Left = (($PageWidth - DllStructGetData($OutSize,"X")) / 2) $result = _WinAPI_TextOut($hPrintDc, $Left, $yTop, $code) _WinAPI_DeleteObject($hFont) ;Print BarCode Meaning $DESIREDFONTSIZE = 12 $hFont = _WinAPI_CreateFont((($DESIREDFONTSIZE * -20) / $TwipsPerPixelY), 0, 0, 0, $FW_NORMAL, False, False, False, _ $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, $DEFAULT_PITCH, 'Arial') _WinAPI_SelectObject($hPrintDc, $hFont) $OutSize = _WinAPI_GetTextExtentPoint32($hPrintDc, $barcode) $yTop = $yTop + 60 $Left = (($PageWidth - DllStructGetData($OutSize,"X")) / 2) $result = _WinAPI_TextOut($hPrintDc, $Left, $yTop, $barcode) _WinAPI_DeleteObject($hFont) $result = _WinAPI_EndPage($hPrintDc) Next EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted May 7, 2012 Share Posted May 7, 2012 Look at OPENBARCODES project http://grandzebu.net/informatique/codbar-en/codbar.htm I sucessfully implemented barcodes (all types) based on this in our big work project. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
autoall Posted May 30, 2012 Share Posted May 30, 2012 Look at OPENBARCODES projecthttp://grandzebu.net/informatique/codbar-en/codbar.htmI sucessfully implemented barcodes (all types) based on this in our big work project.Great project, I'm trying to implement it with autoit, can you share some code?thanks! Link to comment Share on other sites More sharing options...
Zedna Posted May 30, 2012 Share Posted May 30, 2012 Great project, I'm trying to implement it with autoit, can you share some code?I will post some code translated to PowerBuilder syntax which is very similar to AutoIt ... Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted May 31, 2012 Share Posted May 31, 2012 (edited) I will post some code translated to PowerBuilder syntax which is very similar to AutoIt ... Here it is: In ZIP archive there are these functions: uf_barcode_128.srf uf_barcode_128_testnum.srf uf_barcode_25i.srf uf_barcode_39.srf uf_barcode_ean13.srf uf_barcode_ean8.srf These functions are translated from original Pascal sources to PowerBuilder syntax which is very similar to AutoIt. Now I stripped some headers and translated my original Czech comments/variable names to English. To use these functions just install barcode fonts available on original site http://grandzebu.net/informatique/codbar-en/codbar.htm and set desired barcode font to label control on your GUI. Then pass original (barcode) text to one of these functions and set result to label by GUICtrlSetData() which show result as barcode rectangles. I don't need barcodes in AutoIt so I didn't translate it to AutoIt myself. But I can help with translating these functions to AutoIt but now I can't do it all myself because lack of free time.BARCODE_powerbuilder.zip Edited May 31, 2012 by Zedna autoall 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
autoall Posted May 31, 2012 Share Posted May 31, 2012 Here it is: In ZIP archive there are these functions: uf_barcode_128.srf uf_barcode_128_testnum.srf uf_barcode_25i.srf uf_barcode_39.srf uf_barcode_ean13.srf uf_barcode_ean8.srf These functions are translated from original Pascal sources to PowerBuilder syntax which is very similar to AutoIt. Now I stripped some headers and translated my original Czech comments/variable names to English. To use these functions just install barcode fonts available on original site http://grandzebu.net/informatique/codbar-en/codbar.htm and set desired barcode font to label control on your GUI. Then pass original (barcode) text to one of these functions and set result to label by GUICtrlSetData() which show result as barcode rectangles. I don't need barcodes in AutoIt so I didn't translate it to AutoIt myself. But I can help with translating these functions to AutoIt but now I can't do it all myself because lack of free time. Thank you! Link to comment Share on other sites More sharing options...
Zedna Posted June 1, 2012 Share Posted June 1, 2012 Look here: autoall 1 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Zedna Posted June 3, 2012 Share Posted June 3, 2012 (edited) New version:- all functions translated to AutoItAvailable functions:barcode_128() barcode_ean8() barcode_ean13() barcode_25i() barcode_39() Edited June 3, 2012 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Hughluta Posted April 22, 2013 Share Posted April 22, 2013 This font tool is able to create code128 with a font and print barcode. Link to comment Share on other sites More sharing options...
seasonewe Posted July 15, 2013 Share Posted July 15, 2013 Why not choose some other barcode generator? According to my experience, I like to use the following barcode creating, you can generate any barcode type. It empowers users with the ability to include an image viewer and pre-processing capabilities such as deskew, despeckle, and annotations alongside barcode reading & writing functionalities. You could integrate your Document Imaging applications, most common 1D, postal and 2D barcodes can be created with VB.NET and C#.NET codes, including UPC/EAN, Code 128, Code 39, GS1-128, Interleaved 2 of 5, Standard (Industrial) 2 of 5, Code 11 (USD-8), Australia Post 4-state Barcode, Royal Mail (RM4SCC), USPS Intelligent Mail, USPS POSTNET, USPS PLANET, Data Matrix, PDF417, MicroPDF417, QR Code, and Micro PDF-417 and more. More than 90 document formats such Bitmap, Metafile and PDF are provided for saving generated barcode images into stream, file, http, ftp... Hope this can help you. It seems that it is not free to use. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now