5/2/2023 0 Comments 3 of 9 barcode generator![]() # encodes numbers and letters, plus all other Code 39 charactersįirst dialog asks for your code (numbers and uppercase letters, plus space, period, # Based on postnet2.py originally 2006.03.06 Gregory Pittman # along with this program if not, write to the Free Software # You should have received a copy of the GNU General Public License # GNU General Public License for more details. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # but WITHOUT ANY WARRANTY without even the implied warranty of # This program is distributed in the hope that it will be useful, # the Free Software Foundation either version 2 of the License, or # it under the terms of the GNU General Public License as published by ![]() # This program is free software you can redistribute it and/or modify I also have added a bailout if you run the script with no document open, since otherwise Scribus will just hang when if scribus.haveDoc() fails. These will be strings, so we need to convert to integer. Note the split syntax, and also that it discards however much whitespace there is between your values. By using the Python string split function, we can enter both values with one dialog, and for those times when you just want to get it on the page and then move it later, we'll put in some default values. Instead of hard-coded X-Pos and Y-Pos, we'll add the ability to assign these. Somebody Please STOP Me! Ok, now let's make it more flexible. The python is a bit clumsy, but it works. Maybe I've Got It Done Now The final itch to scratch were those remaining characters, so now the Code 39 set is complete. In this example '^' would also not be encodable. I've also added a warning when you try to code a character that this script won't, so you get a message like this:Īs written, it stops at the first non-codable character, even though it does show you your entire entry. This is another advantage of doing this as a script rather than with some outside utility that creates an image of the code. ![]() I see examples where the numbers are more spaced out than this, but of course you can make this adjustment afterward according to your own taste, so it helps to have the frame be as wide as the entire code. This takes your entry, creates a text frame as wide as the code but 3 points below the bottom, enters the text, centers it, with an 8-point Deja Vu Sans Book font. Oh, Why Not? In keeping with the way that sometimes scripts keep getting things added, now we have added the ability to print human-readable characters under the code, decided with a third dialog. The first iterations would only generate a code for digits and uppercase letters (plus the start/stop character), but now it's complete. I had thought it was rather slow, but rechecking shows acceptable speed on various computers. So far it's been Ok, but this might affect the scanning process. Unfortunately, the barcode generator in Scribus cannot be scripted, and in fact you cannot make a custom size for the barcode, so I was copying the 10-digit number, then running Barcode generator, then resizing the created code, which is a PostScript creation, so when it's resized, the width of the bars may change. By trial and error I determined that this was a Code39 barcode. The script creates that custom part, which has a 10-digit number, then underneath is the barcode. The reason for writing this script was that I had already written a script for modifying a form we use, and on this form are barcodes, one of which indicates the type of form, but the other is variable according to the content of the page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |