-
Notifications
You must be signed in to change notification settings - Fork 19
/
cups-page-label.patch
92 lines (86 loc) · 2.76 KB
/
cups-page-label.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
diff -up cups-1.4.1/filter/pstops.c.page-label cups-1.4.1/filter/pstops.c
--- cups-1.4.1/filter/pstops.c.page-label 2009-10-02 12:33:33.410719651 +0100
+++ cups-1.4.1/filter/pstops.c 2009-10-02 12:34:11.399594180 +0100
@@ -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? */
@@ -2048,7 +2049,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu
* of the pages...
*/
- if (Orientation & 1)
+ if (doc->orientation & 1)
write_label_prolog(doc, doc->page_label, PageBottom,
PageWidth - PageLength + PageTop, PageLength);
else
@@ -2056,7 +2057,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu
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;
+ }
+ }
}
@@ -2141,7 +2165,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
case 1 :
if (doc->use_ESPshowpage)
{
- write_labels(doc, Orientation);
+ write_labels(doc, doc->orientation);
doc_puts(doc, "ESPshowpage\n");
}
break;
@@ -2156,7 +2180,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
* Rotate the labels back to portrait...
*/
- write_labels(doc, Orientation - 1);
+ write_labels(doc, doc->orientation - 1);
}
else if (Orientation == 0)
{
@@ -2182,7 +2206,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum
default :
if (is_last_page(number) && doc->use_ESPshowpage)
{
- write_labels(doc, Orientation);
+ write_labels(doc, doc->orientation);
doc_puts(doc, "ESPshowpage\n");
}
break;
@@ -2385,6 +2409,12 @@ set_pstops_options(
doc->new_bounding_box[3] = INT_MIN;
/*
+ * Save original orientation of the document
+ */
+
+ doc->orientation = Orientation;
+
+ /*
* AP_FIRSTPAGE_InputSlot
*/