I decided to open a new topic about this because, maybe, it is of common interest.
After opening this page pointed out by Raymond Wiker (original message) I decided to inspect the source code (HTML) of the resulting bar coded page and surprisingly found a sequence of HTML codes like this one:
<rect fill="black" height="30" width="1.575" y="44" x="20"></rect>
I mean, the bars are actually drawn as rectangles with height="30" and width="1.575" for 'zero' or width="3.3249999999999997" for 'one'. y="44" is the relative location of ROW 1, being y="86" for ROW 2, y="128" for ROW 3 and so. The x="20" is the vertical alignment (column) of the bar, and it goes higher (rightmost) for each new bar, depending on the previous one being a '0' or a '1'.
It has probably taken some time to get to this format, but once the bars are generated this way, I guess the printout will be clean and free of bleeding (shaded areas between spaces and bars).
I liked it very much!
Comments?
Thanks.
Luiz (Brazil)
Edited: 6 Apr 2012, 12:06 a.m.
Glad you liked it :-)
The output is generated using scalable vector graphics (SVN), with the relative widths of zero/one/space given by the recommendations in the HP41 book named "Creating Your Own HP-41 Barcode Manual" (or something very much like it).
The number 3.3249999999999997 should be 3.325, but due to a combination of the inherent inexactitude of floating-point arithmetic and my own inherent lazyness, it ends up looking somewhat odd.
One advantage of using SVN is that the output is scalable, so it is possible to magnify or reduce the output without losing (much) of the accuracy.
Edited: 6 Apr 2012, 3:32 a.m.
Hi, Raymond.
Congratulations for your excellent bar code creator. It is indeed a lot practical and handy! And because you use vectorized output, printing quality is somehow printer independent.
Quote:
The number 3.3249999999999997 should be 3.325
I was wondering about the reason being related to some floating-point operation, but also considered it was a way to prevent rounding errors to propagate and make bar codes with many bytes harder to read.
Quote:
One advantage of using SVN is that the output is scalable
Indeed, this is undoubtedly a great advantage. I also thought about to print the resulting HTML page as a PDF through some of these low budget, even free PDF converters and test the printed output, but I must confess I did not move ahead with that.
Thanks for sharing your bar code creator.
Cheers.
Luiz (Brazil)
I suspect you mean SVG for Scalable Vector Graphics.
I created a hardware waveform design tool using SVG a couple of years ago and discovered that not all browsers at that time supported it. Notably, IE did not support it "out of the box". My recollection is that you could download a module to make it be recognized by IE but that module kept issuing a warning something to the effect that "you are about to run active code and this may be dangerous". Give me a break!
I use Linux now and am not sure if MS has finally gotten with the program. All other browsers I tested handled SVG natively -- though none handled the SVG test suite flawlessly. Things may be different now.
The absolutely lovely feature about SVG is, as its name implies, that it is scalable and will display nice, crisp edges and figures no matter what scale you render it at.
Great use of the language Raymond!
Oops... yes, you're right. SVN is the short name for Subversion, which is a version control system.
The web-based generator works for IE9, and possibly also for IE8 - I have not tested IE8. It probably does not work with IE7 or earlier, unless a separate SVG module has been installed.
BTW, for anybody who wants to run the web-based generator on their own site, the code (3 files: index.html, hp41barcode.js, functions.js) can be downloaded from GitHub
Hi, Raymond.
In this event, how would you like to be credited? Without credits, I would not dare sharing it...
Cheers.
Luiz (Brazil)
A link to the original code repository (http://github.com/rwiker/hp41barcode) should be sufficient. In addition, if you make changes to the code (bug fixes or enhancements), I would appreciate it if you could pass them on to me.