boris.nihil 0 Posted December 28, 2023 Does anybody have experience with 2d barcode, TurboPower SysTools, component StPDF417Barcode... I can't add StPDF417Barcode1.code = '...' witch contains some local letters (ŠĐČĆŽš), it says "Range check error"... virm_grad ,virm_adresa ,virm_naziv:string; virm_naziv := utf8encode('dsdddddd'); virm_adresa := utf8encode('ŠĐŠĐČĆĆČĆČ'); virm_grad := utf8encode('špšpUIZUZUZ'); StPDF417Barcode1.Code := 'HRVHUB30' + #13#10 + 'EUR' + #13#10 + virm_naziv + #10 + virm_adresa + #10 + virm_grad + #10; Share this post Link to post
Lajos Juhász 293 Posted December 29, 2023 You can find an answer at https://en.wikipedia.org/wiki/PDF417, use only A-Z. Share this post Link to post
boris.nihil 0 Posted December 29, 2023 in instructions PDF, they say: Simbol UTF-8 Hex Č C4 8C č C4 8D Ć C4 86 ć C4 87 Đ C4 90 ------------------------- how to use it in delphi code ? Share this post Link to post
aehimself 396 Posted December 29, 2023 The Wikipedia page @Lajos Juhász linked clearly explains you cannot use anything else other that a..z and A..Z: As for UTF8 that is used in PDF documents, which is not the same as the barcode format. Share this post Link to post
Brian Evans 105 Posted December 29, 2023 (edited) Looking at the source code and the error it looks like it tries to use text mode which then fails since that mode supports a limited set of characters. It uses some internal functions to test what mode it should use based on the input string but gets it wrong with your strings. The component does support an extended syntax where the bytes can be represented directly in the string using escape codes \ddd so you could convert the whole string to a UTF8string then build a string to input by escaping each byte value in the UTF8 string into the input string. Not as easy as it sounds due how Delphi tries to help with strings. No luck trying to get this to work either- Delphi really fights too hard and the docs do not help any. Copied St2DBarC.pas to the project directory and modified the GoodForNumericCompaction and GoodForTextCompaction by commenting out everything but the first line's Result := False; This forces binary mode. Still making sure the correct bytes are encoded seems iffy as the barcode looks too wide after passing in just \196\140. Edited December 29, 2023 by Brian Evans Share this post Link to post
boris.nihil 0 Posted December 30, 2023 Thanks Brian, by putting Datamode to binary solved the problem Share this post Link to post