forked from simonbengtsson/jsPDF-AutoTable
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
226 lines (198 loc) · 6.03 KB
/
index.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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/pure-min.css">-->
<link rel="stylesheet" href="libs/pure-min.css">
<!--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/0.6.0/grids-responsive-min.css">-->
<link rel="stylesheet" href="libs/grids-responsive-min.css">
<title>AutoTable sample</title>
<style>
* {
box-sizing: border-box;
}
html, body {
height: 100%;
overflow: hidden;
}
.navbar {
position: absolute;
top: 0;
left: 0;
right: 0;
background: #e74c3c;
border-bottom: 5px solid #c0392b;
height: 50px;
white-space: nowrap;
overflow-x: auto;
overflow-y: hidden;
padding: 0 10px;
}
.navbar h1 {
font-size: 20px;
color: #fff;
}
.menu {
padding: 0;
list-style: none;
}
.menu li {
vertical-align: top;
}
.menu li a {
text-decoration: none;
color: #fff;
font-weight: bold;
font-family: sans-serif;
padding: 10px 0;
line-height: 25px;
}
.menu li a:hover {
font-style: italic;
}
#panel {
background: #141f2b;
padding: 10px;
height: 100%;
}
#wrapper {
overflow: hidden;
height: 100%;
background: rgba(193, 193, 193, 1);
}
#output {
width: 100%;
height: 100%;
background: rgba(193, 193, 193, 1);
}
</style>
</head>
<body>
<header class="navbar">
<h1>
AutoTable - Generate PDF tables and lists (jsPDF plugin)
<!--<iframe style="display: inline; vertical-align: middle; margin-left: 10px;"
src="https://ghbtns.com/github-btn.html?user=simonbengtsson&repo=jsPDF-AutoTable&type=star&count=true&size=medium"
frameborder="0" scrolling="0" width="160px" height="20px"></iframe>-->
</h1>
</header>
<div class="pure-g" style="padding-top: 50px; height: 100%;">
<div id="panel" class="pure-u-1 pure-u-md-1-5">
<ul class="menu">
<li><a href="#">Default</a></li>
<li><a href="#minimal">Minimal</a></li>
<li><a href="#long">Long text</a></li>
<li><a href="#content">With content</a></li>
<li><a href="#multiple">Multiple tables</a></li>
<li><a href="#html">From html</a></li>
<li><a href="#header-footer">Header and footer</a></li>
<li><a href="#defaults">Setting defaults</a></li>
<li><a href="#horizontal">Horizontal headers</a></li>
<li><a href="#spans">Rowspan and colspan</a></li>
<li><a href="#themes">Themes</a></li>
<li><a href="#custom">Custom style</a></li>
</ul>
<button id="download-btn" class="pure-button">Download PDF</button>
<!--<div class="editor">
<pre><code class="javascript">var test = "hey!";</code></pre></div>-->
</div>
<div id="wrapper" class="pure-u-1 pure-u-md-4-5">
<iframe id="output"></iframe>
</div>
</div>
<table id="basic-table" style="display: none;">
<thead>
<tr>
<th>ID</th>
<th>First name</th>
<th>Last name</th>
<th>Email</th>
<th>Country</th>
<th>IP-address</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Donna</td>
<td>Moore</td>
<td>[email protected]</td>
<td>China</td>
<td>211.56.242.221</td>
</tr>
<tr>
<td>2</td>
<td>Janice</td>
<td>Henry</td>
<td>[email protected]</td>
<td>Ukraine</td>
<td>38.36.7.199</td>
</tr>
<tr>
<td>3</td>
<td>Ruth</td>
<td>Wells</td>
<td>[email protected]</td>
<td>Trinidad and Tobago</td>
<td>19.162.133.184</td>
</tr>
<tr>
<td>4</td>
<td>Jason</td>
<td>Ray</td>
<td>[email protected]</td>
<td>Brazil</td>
<td>10.68.11.42</td>
</tr>
<tr>
<td>5</td>
<td>Jane</td>
<td>Stephens</td>
<td>[email protected]</td>
<td>United States</td>
<td>47.32.129.71</td>
</tr>
<tr>
<td>6</td>
<td>Adam</td>
<td>Nichols</td>
<td>[email protected]</td>
<td>Canada</td>
<td>18.186.38.37</td>
</tr>
</tbody>
</table>
<!-- All major versions of jspdf should work (0.9.0, 1.0.x, 1.2.x and 1.3.x) -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/0.9.0/jspdf.source.js"></script>-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.2.61/jspdf.debug.js"></script>-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.2/jspdf.debug.js"></script>-->
<script src="libs/jspdf.debug.js"></script>
<script src="libs/faker.min.js"></script>
<script src="libs/jspdf.plugin.autotable.js"></script>
<script src="examples.js"></script>
<!-- Some scripts to make the examples work nicely -->
<script>
window.onhashchange = function () {
update();
};
document.getElementById('download-btn').onclick = function () {
update(true);
};
function update(shouldDownload) {
var funcStr = window.location.hash.replace(/#/g, '') || 'auto';
var doc = examples[funcStr]();
doc.setProperties({
title: 'Example: ' + funcStr,
subject: 'A jspdf-autotable example pdf (' + funcStr + ')'
});
if (shouldDownload) {
doc.save('table.pdf');
} else {
document.getElementById("output").src = doc.output('datauristring');
}
}
update();
</script>
</body>
</html>