blob: e82c133e008e584290d638bbeb159bb527bde9ce (
plain)
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
|
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PDF rotate</title>
<script>
window.addEventListener("load",function(){
var errc=location.href.split("?err=")[1];
if(errc){
if(errc=="nopdf")alert("That doesn't seem to be a PDF document.");
else if(errc=="rot0")alert("Haha your document was already upright. Maybe just use that instead?");
else if(errc=="invrot")alert("Don't bug my form, that rotation was invalid!");
else if(errc=="pdfjamerr")alert("An error occurred trying to convert that document. Maybe it isn't a PDF document?");
else alert("Unknown error occurred ('"+errc+"')");
}
});
</script>
<style>
.pagediagram {
display: inline-block;
border: 1px black solid;
width: 40px;
height: 56px;
font-family: sans-serif;
font-size: 40px;
text-align: center;
margin-left: 9px;
margin-right: 9px;
line-height: 62px;
}
</style>
</head>
<body>
<h1>PDF rotate</h1>
<p>Select a PDF file below.</p>
<form method="POST" action="/pdfrotate/upload" enctype="multipart/form-data">
<input type="file" id="file" name="file" required><br>
<p>Click the button that looks most like the document you have. We will turn it upright.</p>
<table><tbody><tr>
<!-- CSS and pdfjam rotation are conveniently each other's inverses. -->
<td style="text-align: center;">
<label for="rot0"><div class="pagediagram" style="transform:rotate(0deg);">A</div></label><br>
<input type="radio" id="rot0" name="rotgroup" value="rot0" required>
</td>
<td style="text-align: center;">
<label for="rot90"><div class="pagediagram" style="transform:rotate(90deg);">A</div></label><br>
<input type="radio" id="rot90" name="rotgroup" value="rot90" required>
</td>
<td style="text-align: center;">
<label for="rot180"><div class="pagediagram" style="transform:rotate(180deg);">A</div></label><br>
<input type="radio" id="rot180" name="rotgroup" value="rot180" required>
</td>
<td style="text-align: center;">
<label for="rot270"><div class="pagediagram" style="transform:rotate(270deg);">A</div></label><br>
<input type="radio" id="rot270" name="rotgroup" value="rot270" required>
</td>
</tr></tbody></table>
<p>Now click the button below to finish the process!</p>
<input type="submit" value="Upload, turn and download result!">
</form>
<br>
<br>
<i><small>This uses <a href="https://github.com/DavidFirth/pdfjam">pdfjam</a> to perform the actual hard work. Credits to me only for the slick rotated A's above.</small></i>
</body>
</html>
|