Version 1.0.0 of my Paint.NET Barcode Plugin is completed. Note: I do not have access to a barcode reader and have not checked the validity of the barcodes, but theyshould be accurate =)
Also, barcodes are rectangular. You will not get very good results if you use this plugin in non-rectangular selections.
Screenshots
Features
- Supports all three Code 39 barcode encodings: Code 39, Code 39 mod 43, and Full ASCII Code 39
- Automatically tries to convert text into an encodable format. (Example: “Sepcot.com” in Code 39 becomes “SEPCOT.COM”)
- Provides visual feedback for text that cannot be encoded. Keep in mind different encoding options offer a different set of characters than can be encoded. If “Code 39” doesn’t work, try “Full ASCII Code 39.”
- Uses the user defined Primary and Secondary colors to build the barcodes. Note: Barcodes built with colors other than Black (Primary) and White (Secondary) will probably not scan correctly.
- The width of the bars in the barcode adjust to fill the available space. No barcode is shown if the surface is too small for the barcode to be completely drawn.
Supported Characters
Code 39 and Code 39 mod 43 support the use of the following characters: 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%
Full ASCII Code 39 supports the use of all ASCII (control and printable) characters.
Text Validation Code:
public static bool validateText(String text, int encoding) { bool passedInspection = true; if (encoding == Barcode.CODE_39 || encoding == Barcode.CODE_39_MOD_43) { passedInspection = Regex.Match(text.ToUpperInvariant(), "^[A-Z0-9-\\.\\$/\\+%\\s]+$").Success; } else if (encoding == Barcode.FULL_ASCII_CODE_39 && 0 != text.Length) { for (int lcv = 0; lcv < text.Length; lcv++) { if ((int)text[lcv] < 0 && (int)text[lcv] > 127) { passedInspection = false; } } } else { passedInspection = false; } return passedInspection; }
For Code 39 and Code 39 mod 43, we have a short set of valid characters. To ensure text validity, I perform a Regular Expression match to see if the text is valid.
For Full ASCII Code 39, control and printable characters are in the valid character set. To ensure validity, I check to see if the integer value of each character falls within the 0-127 range.
Files
- Barcode Plugin Source Code - to install, drop the Barcode.dll file into your effects directory (typically: C:\Program Files\Paint.Net\Effects\)