/*
- * "$Id$"
+ * "$Id: rastertolabel.c 6649 2007-07-11 21:46:42Z mike $"
*
* Label printer filter for the Common UNIX Printing System (CUPS).
*
- * Copyright 2001-2006 by Easy Software Products.
+ * Copyright 2007 by Apple Inc.
+ * Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
#include <cups/cups.h>
#include <cups/string.h>
+#include <cups/i18n.h>
#include "raster.h"
#include <stdlib.h>
#include <unistd.h>
* Set label size...
*/
- printf("q%d\n", header->cupsWidth);
+ printf("q%d\n", (header->cupsWidth + 7) & ~7);
break;
case ZEBRA_ZPL :
printf("! 0 %u %u %u %u\r\n", header->HWResolution[0],
header->HWResolution[1], header->cupsHeight,
header->NumCopies);
+ printf("PAGE-WIDTH %d\r\n", header->cupsWidth);
+ printf("PAGE-HEIGHT %d\r\n", header->cupsWidth);
break;
case INTELLITECH_PCL :
/* inPrintDensity */
printf("\033&d%dA", 30 * header->cupsCompression / 100 - 15);
- if (header->cupsRowCount != ~0)
- /* inTearInterval */
- printf("\033!n%dT", header->cupsRowCount);
+ if ((choice = ppdFindMarkedChoice(ppd, "inPrintMode")) != NULL)
+ {
+ if (!strcmp(choice->choice, "Standard"))
+ fputs("\033!p0M", stdout);
+ else if (!strcmp(choice->choice, "Tear"))
+ {
+ fputs("\033!p1M", stdout);
+
+ if (header->cupsRowCount) /* inTearInterval */
+ printf("\033!n%dT", header->cupsRowCount);
+ }
+ else
+ {
+ fputs("\033!p2M", stdout);
- if (header->cupsRowStep != ~0)
- /* inCutInterval */
- printf("\033!n%dC", header->cupsRowStep);
+ if (header->cupsRowStep) /* inCutInterval */
+ printf("\033!n%dC", header->cupsRowStep);
+ }
+ }
}
/*
* Print the label...
*/
- puts("FORM\r");
+ if ((choice = ppdFindMarkedChoice(ppd, "zeMediaTracking")) == NULL ||
+ strcmp(choice->choice, "Continuous"))
+ puts("FORM\r");
+
puts("PRINT\r");
break;
* Run-length compress the graphics...
*/
- for (compptr = CompBuffer, repeat_char = CompBuffer[0], repeat_count = 1;
+ for (compptr = CompBuffer + 1, repeat_char = CompBuffer[0], repeat_count = 1;
*compptr;
compptr ++)
if (*compptr == repeat_char)
*/
if (repeat_count & 1)
+ {
+ repeat_count --;
putchar('0');
+ }
- putchar(',');
+ if (repeat_count > 0)
+ putchar(',');
}
else
ZPLCompress(repeat_char, repeat_count);
+ fflush(stdout);
+
/*
* Save this line for the next round...
*/
* and return.
*/
- fputs("ERROR: rastertolabel job-id user title copies options [file]\n", stderr);
+ fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
+ argv[0]);
return (1);
}
*/
if ((y & 15) == 0)
- fprintf(stderr, "INFO: Printing page %d, %d%% complete...\n", Page,
+ fprintf(stderr, _("INFO: Printing page %d, %d%% complete...\n"), Page,
100 * y / header.cupsHeight);
/*
*/
if (Page == 0)
- fputs("ERROR: No pages found!\n", stderr);
+ fputs(_("ERROR: No pages found!\n"), stderr);
else
- fputs("INFO: Ready to print.\n", stderr);
+ fputs(_("INFO: Ready to print.\n"), stderr);
return (Page == 0);
}
/*
- * End of "$Id$".
+ * End of "$Id: rastertolabel.c 6649 2007-07-11 21:46:42Z mike $".
*/