-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathbooklet-page-calculator.html
125 lines (105 loc) · 4.17 KB
/
booklet-page-calculator.html
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<html>
<head>
<!-- https://github.com/iibm1/booklet-page-calculator -->
<title>Booklet Printing</title>
<script type="text/javascript">
function calculate()
{
duplex = document.getElementById('duplex').value;
direction = document.getElementById('direction').value;
if (duplex == "Yes") {
document.getElementById("doublesided").style.display = "block";
document.getElementById("singlesided").style.display = "none";
}
else {
document.getElementById("doublesided").style.display = "none";
document.getElementById("singlesided").style.display = "block";
}
count = document.getElementById('count').value;
var duplexlist = '';
var side1list = '';
var side2list = '';
for (var i = 1; i < count / 2; i = i + 2) {
var new1;
var new2;
if (direction == "LTR") {
var new1 = (count - i+1).toString() + ',' + i.toString() + ',';
var new2 = (i + 1).toString() + ',' + (count - i).toString() + ',';
}
else {
// RTL; this is the above two lines with each pair of numbers in the
// other order
var new1 = i.toString() + ',' + (count - i+1).toString() + ',';
var new2 = (count - i).toString() + ',' + (i + 1).toString() + ',';
}
side1list = side1list + new1;
side2list = side2list + new2;
duplexlist = duplexlist + new1 + new2;
}
// delete last comma
side1list = side1list.substr(0, side1list.length - 1);
side2list = side2list.substr(0, side2list.length - 1);
duplexlist = duplexlist.substr(0, duplexlist.length - 1);
document.getElementById('side1list').value = side1list;
document.getElementById('side2list').value = side2list;
document.getElementById('duplexlist').value = duplexlist;
}
function init()
{
selectCount = document.getElementById('count');
for (var i = 4; i <= 1000; i = i + 4) {
selectCount.options[selectCount.length] = new Option(i);
}
calculate();
}
document.addEventListener("DOMContentLoaded", init);
</script>
<style>
li {
line-height: 2em;
}
</style>
</head>
<body>
<h2>Booklet Printing</h2>
<p>You can print booklets with your regular printer without installing any
extra plugins, and even if your software does not have booklet support.</p>
<h3>Preparation</h3>
<form>
<ol>
<li>Make sure your document's page count is divisible by 4, i.e. it contains 4 or 8 or 12 or ... pages. If not, add empty pages.</li>
<li>
Select the page count of your document:
<select id="count" onchange="calculate();"> </select>
</li>
<li>
Does your printer print double-sided?
<select id="duplex" onchange="calculate();">
<option value="No">No</option>
<option value="Yes">Yes</option>
</select>
</li>
<li>
Is the language read left-to-right (usual) or right-to-left (Hebrew, Farsi etc.)?
<select id="direction" onchange="calculate();">
<option value="LTR">Left-to-right (usual)</option>
<option value="RTL">Right-to-left (unusual)</option>
</select>
</li>
</ol>
<h3>Printing</h3>
<ol id="doublesided">
<li>Set your printer's "pages per side" setting to 2.</li>
<li>Set your printer's "2-sided" (duplex) setting to "Short Edge", "Short Edge Binding", "Flip" or similar.
<li>Print pages in this order: <input type="text" id="duplexlist" size="50" /></li>
</ol>
<ol id="singlesided">
<li>Set your printer's "pages per side" setting to 2.</li>
<li>Print these pages first: <input type="text" id="side1list" size="50" /></li>
<li>Flip the printed pages and put them back into your printer.</li>
<li>Now print these pages: <input type="text" id="side2list" size="50" /></li>
</ol>
</form>
<a href="https://github.com/georgjaehnig/booklet-page-calculator"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/38ef81f8aca64bb9a64448d0d70f1308ef5341ab/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6461726b626c75655f3132313632312e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"></a>
</body>
</html>