Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How tp print barcodes containing letters
Message
From
20/01/2022 08:13:14
 
 
To
20/01/2022 07:32:33
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
01683294
Message ID:
01683295
Views:
65
Why reinvent the wheel? https://github.com/VFPX/FoxBarcode

>How to print codes
>
>E27H, D18H, F28G, J16H, E19G, G29F, I19F, K09F, L18F
>
>as barcodes from Visual FoxPro application.
>I tried code below with Code 128 font but barcodes for those codes are created incorrectly:
>
> StrTo128B('D18H') appears as D18 in printer bar code
> StrTo128B('F28G') appears as 228
> StrTo128B('J16H') appears as J16
>
>https://i.stack.imgur.com/dCmDb.png
>
>It looks like if StrTo128B() result contains chr(81) and some other characters, those will not appear in output file.
>
>Other bar codes are printed correctly. Use font script is not checked in report designer.
>
>https://i.stack.imgur.com/szZGd.png
>
    * Converts a string to be printed with
>    * True Type Font "PF Barcode 128"
>    * Numerics and alphabetic (upper and lower case)
>    * If a character is not valid it is replaced by a space
>    * USE: _StrTo128B('Codigo 128 B')
>    * RETURNS: Character
>    
>    * http://www.portalfox.com/index.php?name=News&file=article&sid=2600
>    FUNCTION StrTo128B(tcString)
>      LOCAL lcStart, lcStop, lcRet, lcCheck, ;
>        lnLong, lnI, lnCheckSum, lnAsc
>      lcStart = CHR(104 + 32)
>      lcStop = CHR(106 + 32)
>      lnCheckSum = ASC(lcStart) - 32
>      lcRet = tcString
>      lnLong = LEN(lcRet)
>      FOR lnI = 1 TO lnLong
>        lnAsc = ASC(SUBS(lcRet,lnI,1)) - 32
>        IF NOT BETWEEN(lnAsc,0,99)
>          lcRet = STUFF(lcRet,lnI,1,CHR(32))
>          lnAsc = ASC(SUBS(lcRet,lnI,1)) - 32
>        ENDIF
>        lnCheckSum = lnCheckSum + (lnAsc * lnI)
>      ENDFOR
>      lcCheck = CHR(MOD(lnCheckSum,103) + 32)
>      lcRet = lcStart + lcRet + lcCheck + lcStop
>      *--- Esto es para cambiar los espacios y caracteres invalidos
>      lcRet = STRTRAN(lcRet,CHR(32),CHR(232))
>      lcRet = STRTRAN(lcRet,CHR(127),CHR(192))
>      lcRet = STRTRAN(lcRet,CHR(128),CHR(193))
>      RETURN lcRet
>    ENDFUNC
>
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform