mirror of
https://git.familie-radermacher.ch/linux/ptouch-print.git
synced 2025-05-13 23:32:59 +00:00
Add --copies switch for multiple printouts (thanks to Wojciech Fred)
This commit is contained in:
parent
bc7d32a6e6
commit
740b20e150
@ -78,7 +78,7 @@ struct _pt_dev_info ptdevs[] = {
|
||||
cutting of tape, printing maximum of 73mm length) */
|
||||
{0x04f9, 0x20e1, "PT-D610BT", 128, 180, FLAG_P700_INIT|FLAG_USE_INFO_CMD|FLAG_HAS_PRECUT|FLAG_D460BT_MAGIC},
|
||||
//{0x04f9, 0x200d, "PT-3600", 384, 360, FLAG_RASTER_PACKBITS},
|
||||
{0x04f9, 0x20af, "PT-P710BT", 128, 180, FLAG_RASTER_PACKBITS},
|
||||
{0x04f9, 0x20af, "PT-P710BT", 128, 180, FLAG_RASTER_PACKBITS|FLAG_HAS_PRECUT},
|
||||
{0,0,"",0,0,0}
|
||||
};
|
||||
|
||||
|
@ -431,6 +431,7 @@ void usage(char *progname)
|
||||
printf("\t--writepng <file>\tinstead of printing, write output to png file\n");
|
||||
printf("\t--force-tape-width <px>\tSet tape width in pixels, use together with\n");
|
||||
printf("\t\t\t\t--writepng without a printer connected.\n");
|
||||
printf("\t--copies <number>\tSets the number of identical prints\n");
|
||||
printf("print commands:\n");
|
||||
printf("\t--image <file>\t\tprint the given image which must be a 2 color\n");
|
||||
printf("\t\t\t\t(black/white) png\n");
|
||||
@ -487,6 +488,12 @@ int parse_args(int argc, char **argv)
|
||||
debug=true;
|
||||
} else if (strcmp(&argv[i][1], "-info") == 0) {
|
||||
continue; /* not done here */
|
||||
} else if (strcmp(&argv[i][1], "-copies") == 0) {
|
||||
if (i+1<argc) {
|
||||
++i;
|
||||
} else {
|
||||
usage(argv[0]);
|
||||
}
|
||||
} else if (strcmp(&argv[i][1], "-image") == 0) {
|
||||
if (i+1<argc) {
|
||||
++i;
|
||||
@ -524,7 +531,7 @@ int parse_args(int argc, char **argv)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i, lines = 0, tape_width;
|
||||
int i, lines = 0, tape_width, copies=1;
|
||||
char *line[MAX_LINES];
|
||||
gdImage *im=NULL;
|
||||
gdImage *out=NULL;
|
||||
@ -629,6 +636,8 @@ int main(int argc, char *argv[])
|
||||
chain = true;
|
||||
} else if (strcmp(&argv[i][1], "-debug") == 0) {
|
||||
debug = true;
|
||||
} else if (strcmp(&argv[i][1], "-copies") == 0) {
|
||||
copies = strtol(argv[++i], NULL, 10);
|
||||
} else {
|
||||
usage(argv[0]);
|
||||
}
|
||||
@ -637,10 +646,12 @@ int main(int argc, char *argv[])
|
||||
if (save_png) {
|
||||
write_png(out, save_png);
|
||||
} else {
|
||||
for (i=0; i<copies; ++i) {
|
||||
print_img(ptdev, out, chain);
|
||||
if (ptouch_finalize(ptdev, chain) != 0) {
|
||||
if (ptouch_finalize(ptdev, ( chain || (i < copies-1) ) ) != 0) {
|
||||
printf(_("ptouch_finalize(%d) failed\n"), chain);
|
||||
return -1;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
gdImageDestroy(out);
|
||||
|
Loading…
Reference in New Issue
Block a user