]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/rastertolabel.c
License change: Apache License, Version 2.0.
[thirdparty/cups.git] / filter / rastertolabel.c
index 6868a73e4fe5fc7085487e3f2a1bc444919c3bde..55501b71554794136f9a01d1af32602b3a9801af 100644 (file)
@@ -1,18 +1,10 @@
 /*
- * "$Id$"
- *
  * Label printer filter for CUPS.
  *
- * Copyright 2007-2014 by Apple Inc.
+ * Copyright 2007-2016 by Apple Inc.
  * Copyright 2001-2007 by Easy Software Products.
  *
- * These coded instructions, statements, and computer programs are the
- * 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.
+ * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
  */
 
 /*
@@ -166,39 +158,15 @@ StartPage(ppd_file_t         *ppd,        /* I - PPD file */
   */
 
   fprintf(stderr, "DEBUG: StartPage...\n");
-  fprintf(stderr, "DEBUG: MediaClass = \"%s\"\n", header->MediaClass);
-  fprintf(stderr, "DEBUG: MediaColor = \"%s\"\n", header->MediaColor);
-  fprintf(stderr, "DEBUG: MediaType = \"%s\"\n", header->MediaType);
-  fprintf(stderr, "DEBUG: OutputType = \"%s\"\n", header->OutputType);
-
-  fprintf(stderr, "DEBUG: AdvanceDistance = %d\n", header->AdvanceDistance);
-  fprintf(stderr, "DEBUG: AdvanceMedia = %d\n", header->AdvanceMedia);
-  fprintf(stderr, "DEBUG: Collate = %d\n", header->Collate);
-  fprintf(stderr, "DEBUG: CutMedia = %d\n", header->CutMedia);
   fprintf(stderr, "DEBUG: Duplex = %d\n", header->Duplex);
-  fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0],
-          header->HWResolution[1]);
-  fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n",
-          header->ImagingBoundingBox[0], header->ImagingBoundingBox[1],
-          header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
-  fprintf(stderr, "DEBUG: InsertSheet = %d\n", header->InsertSheet);
-  fprintf(stderr, "DEBUG: Jog = %d\n", header->Jog);
-  fprintf(stderr, "DEBUG: LeadingEdge = %d\n", header->LeadingEdge);
-  fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0],
-          header->Margins[1]);
+  fprintf(stderr, "DEBUG: HWResolution = [ %d %d ]\n", header->HWResolution[0], header->HWResolution[1]);
+  fprintf(stderr, "DEBUG: ImagingBoundingBox = [ %d %d %d %d ]\n", header->ImagingBoundingBox[0], header->ImagingBoundingBox[1], header->ImagingBoundingBox[2], header->ImagingBoundingBox[3]);
+  fprintf(stderr, "DEBUG: Margins = [ %d %d ]\n", header->Margins[0], header->Margins[1]);
   fprintf(stderr, "DEBUG: ManualFeed = %d\n", header->ManualFeed);
   fprintf(stderr, "DEBUG: MediaPosition = %d\n", header->MediaPosition);
-  fprintf(stderr, "DEBUG: MediaWeight = %d\n", header->MediaWeight);
-  fprintf(stderr, "DEBUG: MirrorPrint = %d\n", header->MirrorPrint);
-  fprintf(stderr, "DEBUG: NegativePrint = %d\n", header->NegativePrint);
   fprintf(stderr, "DEBUG: NumCopies = %d\n", header->NumCopies);
   fprintf(stderr, "DEBUG: Orientation = %d\n", header->Orientation);
-  fprintf(stderr, "DEBUG: OutputFaceUp = %d\n", header->OutputFaceUp);
-  fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0],
-          header->PageSize[1]);
-  fprintf(stderr, "DEBUG: Separations = %d\n", header->Separations);
-  fprintf(stderr, "DEBUG: TraySwitch = %d\n", header->TraySwitch);
-  fprintf(stderr, "DEBUG: Tumble = %d\n", header->Tumble);
+  fprintf(stderr, "DEBUG: PageSize = [ %d %d ]\n", header->PageSize[0], header->PageSize[1]);
   fprintf(stderr, "DEBUG: cupsWidth = %d\n", header->cupsWidth);
   fprintf(stderr, "DEBUG: cupsHeight = %d\n", header->cupsHeight);
   fprintf(stderr, "DEBUG: cupsMediaType = %d\n", header->cupsMediaType);
@@ -208,9 +176,6 @@ StartPage(ppd_file_t         *ppd,  /* I - PPD file */
   fprintf(stderr, "DEBUG: cupsColorOrder = %d\n", header->cupsColorOrder);
   fprintf(stderr, "DEBUG: cupsColorSpace = %d\n", header->cupsColorSpace);
   fprintf(stderr, "DEBUG: cupsCompression = %d\n", header->cupsCompression);
-  fprintf(stderr, "DEBUG: cupsRowCount = %d\n", header->cupsRowCount);
-  fprintf(stderr, "DEBUG: cupsRowFeed = %d\n", header->cupsRowFeed);
-  fprintf(stderr, "DEBUG: cupsRowStep = %d\n", header->cupsRowStep);
 
   switch (ModelNumber)
   {
@@ -467,7 +432,7 @@ StartPage(ppd_file_t         *ppd,  /* I - PPD file */
  */
 
 void
-EndPage(ppd_file_t *ppd,               /* I - PPD file */
+EndPage(ppd_file_t          *ppd,      /* I - PPD file */
         cups_page_header2_t *header)   /* I - Page header */
 {
   int          val;                    /* Option value */
@@ -498,6 +463,13 @@ EndPage(ppd_file_t *ppd,           /* I - PPD file */
        */
 
         puts("P1");
+
+       /*
+        * Cut the label as needed...
+        */
+
+       if (header->CutMedia)
+         puts("C");
        break;
 
     case ZEBRA_ZPL :
@@ -517,6 +489,19 @@ EndPage(ppd_file_t *ppd,           /* I - PPD file */
 
         puts("^XA");
 
+       /*
+        * Rotate 180 degrees so that the top of the label/page is at the
+       * leading edge...
+       */
+
+       puts("^POI");
+
+       /*
+        * Set print width...
+       */
+
+        printf("^PW%u\n", header->cupsWidth);
+
        /*
         * Set print rate...
        */
@@ -627,8 +612,15 @@ EndPage(ppd_file_t *ppd,           /* I - PPD file */
         * End the label and eject...
        */
 
-        puts("^IDR:CUPS.GRF^FS");
        puts("^XZ");
+        puts("^IDR:CUPS.GRF^FS");
+
+       /*
+        * Cut the label as needed...
+        */
+
+       if (header->CutMedia)
+         puts("^CN1");
         break;
 
     case ZEBRA_CPCL :
@@ -1291,8 +1283,3 @@ main(int  argc,                           /* I - Number of command-line arguments */
   else
     return (0);
 }
-
-
-/*
- * End of "$Id$".
- */