[cups] Cut paper

Michael Sweet msweet at apple.com
Wed Dec 16 10:07:06 PST 2015


Simon,

Please do file a bug.  It looks like the current sample EPL2 driver does not support the EPL2 "C" (cut immediate) command, documented here:

    https://www.zebra.com/content/dam/zebra/manuals/en-us/printer/epl2-pm-en.pdf

That is preventing the CutMedia option from doing anything.

...

Oh, and here is a patch you can apply to the current rastertolabel.c sources to make them support the CutMedia option (for both EPL2 and ZPL printers):

===================================================================
--- filter/rastertolabel.c	(revision 13008)
+++ filter/rastertolabel.c	(working copy)
@@ -471,6 +471,13 @@
 	*/
 
         puts("P1");
+
+       /*
+        * Cut the label as needed...
+        */
+
+      	if (header->CutMedia)
+	  puts("C");
 	break;
 
     case ZEBRA_ZPL :
@@ -602,6 +609,13 @@
 
         puts("^IDR:CUPS.GRF^FS");
 	puts("^XZ");
+
+       /*
+        * Cut the label as needed...
+        */
+
+      	if (header->CutMedia)
+	  puts("^CN1");
         break;
 
     case ZEBRA_CPCL :


> On Dec 16, 2015, at 9:48 AM, Helge Blischke <helgeblischke at web.de> wrote:
> 
> 
>> Well, I’ll install a fake zebra printer to be able to look into the output
>> of gstoraster as well as rastertolabel and trace down where the
>> CutMedia stuff disappears.
>> 
>> Helge
> 
> Well, I’ve done that, using your PPD.
> 
> Here is an excerpt of the cups error_log when printing a test page:
> 
> ….
> I [16/Dec/2015:15:18:05 +0100] [Job 297] Started filter /usr/libexec/cups/filter/cgbannertopdf (PID 7128)
> I [16/Dec/2015:15:18:05 +0100] [Job 297] Started filter /usr/libexec/cups/filter/gstoraster (PID 7129)
> I [16/Dec/2015:15:18:05 +0100] [Job 297] Started filter /usr/libexec/cups/filter/rastertolabel (PID 7130)
> I [16/Dec/2015:15:18:05 +0100] [Job 297] Started backend /usr/libexec/cups/backend/socket (PID 7131)
> 
> ….
> 
> D [16/Dec/2015:15:18:06 +0100] [Job 297] StartPage...
> D [16/Dec/2015:15:18:06 +0100] [Job 297] MediaClass = ""
> D [16/Dec/2015:15:18:06 +0100] [Job 297] MediaColor = ""
> D [16/Dec/2015:15:18:06 +0100] [Job 297] MediaType = ""
> D [16/Dec/2015:15:18:06 +0100] [Job 297] OutputType = ""
> D [16/Dec/2015:15:18:06 +0100] [Job 297] AdvanceDistance = 0
> D [16/Dec/2015:15:18:06 +0100] [Job 297] AdvanceMedia = 0
> D [16/Dec/2015:15:18:06 +0100] [Job 297] Collate = 0
> D [16/Dec/2015:15:18:06 +0100] [Job 297] CutMedia = 4
> D [16/Dec/2015:15:18:06 +0100] [Job 297] Duplex = 0
> D [16/Dec/2015:15:18:06 +0100] [Job 297] HWResolution = [ 203 203 ]
> D [16/Dec/2015:15:18:06 +0100] [Job 297] ImagingBoundingBox = [ 0 0 288 360 ]
> D [16/Dec/2015:15:18:06 +0100] [Job 297] InsertSheet = 0
> D [16/Dec/2015:15:18:06 +0100] [Job 297] Jog = 0
> 
>> 
> You see, the raster data header has the "CutMedia = 4“ set.
> 
> The EPL2 data stream looks like (beginning and end):
> 
> N
> D10
> q816
> GW0,0,102,1
> …data…
>>> GW0,1014,102,1
> …data…
> P1
> 
> You see, the data stream begins with the commands to reset the printer,
> set the density and the label width, followed by a series of graphic data lines,
> and ends with the command to print one label.
> 
> There is no cutting related command whatsoever – there should be the C command
> at the end to cut immediately.
> 
> So, I think there is a bug in the rastertolabel filter. 
> I looked into the source of this filter (cups version 2.1.0) and found that cutting is only
> implemented for ZPL printers.
> 
> So I’d suggest you file a bug at cups.org <http://cups.org/> and see what Michael Sweet replies.
> 
> In the meantime you could perhaps hack (or let hack) a wrapper script around
> the rastertolabel filter that looks for the CutMedia setting in the input and appends
> the cut command to the output, and it certainly would be your turn to do the testing
> with the real printer.
> 
> Helge
> 
> _______________________________________________
> cups mailing list
> cups at cups.org
> https://www.cups.org/mailman/listinfo/cups

_________________________________________________________
Michael Sweet, Senior Printing System Engineer




More information about the cups mailing list