]>
Commit | Line | Data |
---|---|---|
f92713d3 SS |
1 | diff -up cups-1.4.5/filter/pstops.c.page-label cups-1.4.5/filter/pstops.c |
2 | --- cups-1.4.5/filter/pstops.c.page-label 2010-08-31 20:36:08.000000000 +0200 | |
3 | +++ cups-1.4.5/filter/pstops.c 2010-11-12 13:11:11.000000000 +0100 | |
4 | @@ -108,6 +108,7 @@ typedef struct /**** Document informa | |
5 | int num_options; /* Number of document-wide options */ | |
6 | cups_option_t *options; /* Document-wide options */ | |
7 | int normal_landscape, /* Normal rotation for landscape? */ | |
8 | + orientation, /* Original orientation of the document */ | |
9 | saw_eof, /* Saw the %%EOF comment? */ | |
10 | slow_collate, /* Collate copies by hand? */ | |
11 | slow_duplex, /* Duplex pages slowly? */ | |
12 | @@ -2083,7 +2084,7 @@ do_setup(pstops_doc_t *doc, /* I - Docu | |
13 | * of the pages... | |
14 | */ | |
15 | ||
16 | - if (Orientation & 1) | |
17 | + if (doc->orientation & 1) | |
18 | write_label_prolog(doc, doc->page_label, PageBottom, | |
19 | PageWidth - PageLength + PageTop, PageLength); | |
20 | else | |
21 | @@ -2091,7 +2092,30 @@ do_setup(pstops_doc_t *doc, /* I - Docu | |
22 | PageLength); | |
23 | } | |
24 | else | |
25 | - write_label_prolog(doc, doc->page_label, PageBottom, PageTop, PageWidth); | |
26 | + { | |
27 | + switch (doc->orientation) | |
28 | + { | |
29 | + case 0 : | |
30 | + write_label_prolog(doc, doc->page_label, PageBottom, PageTop, | |
31 | + PageWidth); | |
32 | + break; | |
33 | + | |
34 | + case 1 : | |
35 | + write_label_prolog(doc, doc->page_label, PageLeft, PageRight, | |
36 | + PageLength); | |
37 | + break; | |
38 | + | |
39 | + case 2 : | |
40 | + write_label_prolog(doc, doc->page_label, PageLength - PageTop, | |
41 | + PageLength - PageBottom, PageWidth); | |
42 | + break; | |
43 | + | |
44 | + case 3 : | |
45 | + write_label_prolog(doc, doc->page_label, PageWidth - PageRight, | |
46 | + PageWidth - PageLeft, PageLength); | |
47 | + break; | |
48 | + } | |
49 | + } | |
50 | } | |
51 | ||
52 | ||
53 | @@ -2176,7 +2200,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum | |
54 | case 1 : | |
55 | if (doc->use_ESPshowpage) | |
56 | { | |
57 | - write_labels(doc, Orientation); | |
58 | + write_labels(doc, doc->orientation); | |
59 | doc_puts(doc, "ESPshowpage\n"); | |
60 | } | |
61 | break; | |
62 | @@ -2191,7 +2215,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum | |
63 | * Rotate the labels back to portrait... | |
64 | */ | |
65 | ||
66 | - write_labels(doc, Orientation - 1); | |
67 | + write_labels(doc, doc->orientation - 1); | |
68 | } | |
69 | else if (Orientation == 0) | |
70 | { | |
71 | @@ -2217,7 +2241,7 @@ end_nup(pstops_doc_t *doc, /* I - Docum | |
72 | default : | |
73 | if (is_last_page(number) && doc->use_ESPshowpage) | |
74 | { | |
75 | - write_labels(doc, Orientation); | |
76 | + write_labels(doc, doc->orientation); | |
77 | doc_puts(doc, "ESPshowpage\n"); | |
78 | } | |
79 | break; | |
80 | @@ -2433,6 +2457,12 @@ set_pstops_options( | |
81 | Orientation = 0; | |
82 | ||
83 | /* | |
84 | + * Save original orientation of the document | |
85 | + */ | |
86 | + | |
87 | + doc->orientation = Orientation; | |
88 | + | |
89 | + /* | |
90 | * AP_FIRSTPAGE_* and the corresponding non-first-page options. | |
91 | */ | |
92 |