mirror of
https://git.code.sf.net/p/zint/code
synced 2025-05-31 07:08:26 -04:00
Add Brizilian CEPNet (almost identical to POSTNET) using Symbol #54
This commit is contained in:
parent
c0ec67f99e
commit
35c207edd4
12 changed files with 386 additions and 207 deletions
|
@ -521,7 +521,7 @@ static const void *barcode_funcs[BARCODE_LAST + 1] = {
|
|||
eanx, NULL, eanx, eanx, NULL, /*35-39*/
|
||||
postnet, NULL, NULL, NULL, NULL, /*40-44*/
|
||||
NULL, NULL, msi_plessey, NULL, fim, /*45-49*/
|
||||
code39, pharma, pzn, pharma_two, NULL, /*50-54*/
|
||||
code39, pharma, pzn, pharma_two, postnet, /*50-54*/
|
||||
pdf417, pdf417, maxicode, qrcode, NULL, /*55-59*/
|
||||
code128, NULL, NULL, auspost, NULL, /*60-64*/
|
||||
NULL, auspost, auspost, auspost, eanx, /*65-69*/
|
||||
|
|
|
@ -132,6 +132,10 @@ static int usps_set_height(struct zint_symbol *symbol, const int no_errtxt) {
|
|||
}
|
||||
|
||||
/* Handles the PostNet system used for Zip codes in the US */
|
||||
/* Also handles Brazilian CEPNet - more information at
|
||||
* https://silo.tips/download/sumario-4-regras-de-endereamento
|
||||
* https://barcodeguide.seagullscientific.com/Content/Symbologies/CEPNet.htm
|
||||
* TODO: Check compliant symbol sizes */
|
||||
static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[], char *d, const int length) {
|
||||
int i, sum, check_digit;
|
||||
int error_number = 0;
|
||||
|
@ -140,9 +144,17 @@ static int postnet_enc(struct zint_symbol *symbol, const unsigned char source[],
|
|||
strcpy(symbol->errtxt, "480: Input too long (38 character maximum)");
|
||||
return ZINT_ERROR_TOO_LONG;
|
||||
}
|
||||
if (length != 5 && length != 9 && length != 11) {
|
||||
strcpy(symbol->errtxt, "479: Input length is not standard (5, 9 or 11 characters)");
|
||||
error_number = ZINT_WARN_NONCOMPLIANT;
|
||||
|
||||
if (symbol->symbology == BARCODE_CEPNET) {
|
||||
if (length != 8) {
|
||||
strcpy(symbol->errtxt, "499: Input is wrong length (should be 8 digits)");
|
||||
error_number = ZINT_WARN_NONCOMPLIANT;
|
||||
}
|
||||
} else {
|
||||
if (length != 5 && length != 9 && length != 11) {
|
||||
strcpy(symbol->errtxt, "479: Input length is not standard (5, 9 or 11 characters)");
|
||||
error_number = ZINT_WARN_NONCOMPLIANT;
|
||||
}
|
||||
}
|
||||
if (!is_sane(NEON_F, source, length)) {
|
||||
strcpy(symbol->errtxt, "481: Invalid character in data (digits only)");
|
||||
|
|
|
@ -178,6 +178,7 @@ extern "C" {
|
|||
#define BARCODE_PHARMA 51 /* Pharmacode One-Track */
|
||||
#define BARCODE_PZN 52 /* Pharmazentralnummer */
|
||||
#define BARCODE_PHARMA_TWO 53 /* Pharmacode Two-Track */
|
||||
#define BARCODE_CEPNET 54 /* Brazilian CEPNet Postal Code */
|
||||
#define BARCODE_PDF417 55 /* PDF417 */
|
||||
#define BARCODE_PDF417COMP 56 /* Compact PDF417 (Truncated PDF417) */
|
||||
#define BARCODE_PDF417TRUNC 56 /* Legacy */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue