2010-06-18 10:51:07 +00:00
|
|
|
diff -up cups-1.4.4/filter/pstops.c.page-label cups-1.4.4/filter/pstops.c
|
|
|
|
--- cups-1.4.4/filter/pstops.c.page-label 2010-03-30 23:07:33.000000000 +0100
|
|
|
|
+++ cups-1.4.4/filter/pstops.c 2010-06-18 09:36:18.239126341 +0100
|
2009-10-02 12:03:19 +00:00
|
|
|
@@ -108,6 +108,7 @@ typedef struct /**** Document informa
|
|
|
|
int num_options; /* Number of document-wide options */
|
|
|
|
cups_option_t *options; /* Document-wide options */
|
|
|
|
int normal_landscape, /* Normal rotation for landscape? */
|
|
|
|
+ orientation, /* Original orientation of the document */
|
|
|
|
saw_eof, /* Saw the %%EOF comment? */
|
|
|
|
slow_collate, /* Collate copies by hand? */
|
|
|
|
slow_duplex, /* Duplex pages slowly? */
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2083,7 +2084,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu
|
2009-10-02 12:03:19 +00:00
|
|
|
* of the pages...
|
|
|
|
*/
|
|
|
|
|
|
|
|
- if (Orientation & 1)
|
|
|
|
+ if (doc->orientation & 1)
|
|
|
|
write_label_prolog(doc, doc->page_label, PageBottom,
|
|
|
|
PageWidth - PageLength + PageTop, PageLength);
|
|
|
|
else
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2091,7 +2092,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu
|
2009-10-02 12:03:19 +00:00
|
|
|
PageLength);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
- write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth);
|
|
|
|
+ {
|
|
|
|
+ switch (doc->orientation)
|
|
|
|
+ {
|
|
|
|
+ case 0 :
|
|
|
|
+ write_label_prolog(doc, doc->page_label, PageBottom, PageTop,
|
|
|
|
+ PageWidth);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 1 :
|
|
|
|
+ write_label_prolog(doc, doc->page_label, PageLeft, PageRight,
|
|
|
|
+ PageLength);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 2 :
|
|
|
|
+ write_label_prolog(doc, doc->page_label, PageLength - PageTop,
|
|
|
|
+ PageLength - PageBottom, PageWidth);
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ case 3 :
|
|
|
|
+ write_label_prolog(doc, doc->page_label, PageWidth - PageRight,
|
|
|
|
+ PageWidth - PageLeft, PageLength);
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2176,7 +2200,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
|
2009-10-02 12:03:19 +00:00
|
|
|
case 1 :
|
|
|
|
if (doc->use_ESPshowpage)
|
|
|
|
{
|
|
|
|
- write_labels(doc, Orientation);
|
|
|
|
+ write_labels(doc, doc->orientation);
|
|
|
|
doc_puts(doc, "ESPshowpage\n");
|
|
|
|
}
|
|
|
|
break;
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2191,7 +2215,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
|
2009-10-02 12:03:19 +00:00
|
|
|
* Rotate the labels back to portrait...
|
|
|
|
*/
|
|
|
|
|
|
|
|
- write_labels(doc, Orientation - 1);
|
|
|
|
+ write_labels(doc, doc->orientation - 1);
|
|
|
|
}
|
|
|
|
else if (Orientation == 0)
|
|
|
|
{
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2217,7 +2241,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
|
2009-10-02 12:03:19 +00:00
|
|
|
default :
|
|
|
|
if (is_last_page(number) && doc->use_ESPshowpage)
|
|
|
|
{
|
|
|
|
- write_labels(doc, Orientation);
|
|
|
|
+ write_labels(doc, doc->orientation);
|
|
|
|
doc_puts(doc, "ESPshowpage\n");
|
|
|
|
}
|
|
|
|
break;
|
2010-06-18 10:51:07 +00:00
|
|
|
@@ -2420,6 +2444,12 @@ set_pstops_options(
|
2009-10-02 12:03:19 +00:00
|
|
|
doc->new_bounding_box[3] = INT_MIN;
|
|
|
|
|
|
|
|
/*
|
|
|
|
+ * Save original orientation of the document
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ doc->orientation = Orientation;
|
|
|
|
+
|
|
|
|
+ /*
|
2010-06-18 10:51:07 +00:00
|
|
|
* AP_FIRSTPAGE_* and the corresponding non-first-page options.
|
2009-10-02 12:03:19 +00:00
|
|
|
*/
|
|
|
|
|