From dbd9786a07e9c10cfe07db58f660fa186243b9a3 Mon Sep 17 00:00:00 2001
From: tomsmeding <tom.smeding@gmail.com>
Date: Thu, 16 Nov 2017 00:33:41 +0100
Subject: Add pdfrotate module

---
 modules/pdfrotate/index.html | 65 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 modules/pdfrotate/index.html

(limited to 'modules/pdfrotate/index.html')

diff --git a/modules/pdfrotate/index.html b/modules/pdfrotate/index.html
new file mode 100644
index 0000000..ae63865
--- /dev/null
+++ b/modules/pdfrotate/index.html
@@ -0,0 +1,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://warwick.ac.uk/fac/sci/statistics/staff/academic-research/firth/software/pdfjam/">pdfjam</a> to perform the actual hard work. Credits to me only for the slick rotated A's above.</small></i>
+</body>
+</html>
-- 
cgit v1.2.3-70-g09d2