int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) { int error_number; char output[4]; switch(rotate_angle) { case 0: case 90: case 180: case 270: break; default: strcpy(symbol->errtxt, "Invalid rotation angle"); return ERROR_INVALID_OPTION; break; } if(strlen(symbol->outfile) > 3) { output[0] = symbol->outfile[strlen(symbol->outfile) - 3]; output[1] = symbol->outfile[strlen(symbol->outfile) - 2]; output[2] = symbol->outfile[strlen(symbol->outfile) - 1]; output[3] = '\0'; to_upper((unsigned char*)output); #ifndef NO_PNG if(!(strcmp(output, "PNG"))) { if(symbol->scale < 1.0) { symbol->text[0] = '\0'; } error_number = png_handle(symbol, rotate_angle); } else #endif if(!(strcmp(output, "TXT"))) { error_number = dump_plot(symbol); } else if(!(strcmp(output, "EPS"))) { error_number = ps_plot(symbol); } else if(!(strcmp(output, "SVG"))) { error_number = svg_plot(symbol); } else { strcpy(symbol->errtxt, "Unknown output format"); error_tag(symbol->errtxt, ERROR_INVALID_OPTION); return ERROR_INVALID_OPTION; } } else { strcpy(symbol->errtxt, "Unknown output format"); error_tag(symbol->errtxt, ERROR_INVALID_OPTION); return ERROR_INVALID_OPTION; } error_tag(symbol->errtxt, error_number); return error_number; }
int main(int argc, char *argv[]) { char *tbl_filename, *input_filename, *output_dir; int mode=0; int i, ret; if (argc < 2) ProgramUsage(); for (i = 1; i < argc; i++) { if (_stricmp(argv[i], "-s") == 0) mode = 0; else if (_stricmp(argv[i], "-p") == 0) mode = 1; else { if (argc-i < 3) ProgramUsage(); tbl_filename = argv[i]; input_filename = argv[i+1]; output_dir = argv[i+2]; break; } } if ((trans_table = Table_Load(tbl_filename)) == NULL) { printf ("table not loaded.\n"); exit (0); } if (mode == 1) ret = dump_plot(input_filename, output_dir); else ret = dump_d00(input_filename, output_dir); Table_Free(trans_table); return ret; }