mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Make Data Matrix retry if data doesn't fit in specified symbol size.
This commit is contained in:
parent
7ab82d09ee
commit
8bb378ed25
@ -1282,6 +1282,19 @@ int dmatrix(struct zint_symbol *symbol, unsigned char source[])
|
|||||||
if(symbol->option_1 == 1) {
|
if(symbol->option_1 == 1) {
|
||||||
/* ECC 200 */
|
/* ECC 200 */
|
||||||
error_number = iec16022ecc200(source, barcodelen, symbol);
|
error_number = iec16022ecc200(source, barcodelen, symbol);
|
||||||
|
if((error_number != 0) && (symbol->option_2 != 0)) {
|
||||||
|
if(strcmp(symbol->errtxt, "Cannot make barcode fit") == 0) {
|
||||||
|
/* Can't fit data in the symbol size specified -
|
||||||
|
use automatic symbol sizing instead */
|
||||||
|
symbol->option_2 = 0;
|
||||||
|
error_number = iec16022ecc200(source, barcodelen, symbol);
|
||||||
|
if(error_number == 0) {
|
||||||
|
/* It worked! */
|
||||||
|
strcpy(symbol->errtxt, "Cannot make barcode fit");
|
||||||
|
error_number = WARN_INVALID_OPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
/* ECC 000 - 140 */
|
/* ECC 000 - 140 */
|
||||||
error_number = matrix89(symbol, source);
|
error_number = matrix89(symbol, source);
|
||||||
|
Loading…
Reference in New Issue
Block a user