diff --git a/src/main/java/stirling/software/SPDF/controller/MultiToolController.java b/src/main/java/stirling/software/SPDF/controller/MultiToolController.java new file mode 100644 index 00000000..4d3c1f88 --- /dev/null +++ b/src/main/java/stirling/software/SPDF/controller/MultiToolController.java @@ -0,0 +1,20 @@ +package stirling.software.SPDF.controller; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class MultiToolController { + + private static final Logger logger = LoggerFactory.getLogger(MultiToolController.class); + + @GetMapping("/multi-tool") + public String multiToolForm(Model model) { + model.addAttribute("currentPage", "multi-tool"); + return "multi-tool"; + } + +} \ No newline at end of file diff --git a/src/main/java/stirling/software/SPDF/controller/PageManagerController.java b/src/main/java/stirling/software/SPDF/controller/PageManagerController.java deleted file mode 100644 index d12e5c71..00000000 --- a/src/main/java/stirling/software/SPDF/controller/PageManagerController.java +++ /dev/null @@ -1,20 +0,0 @@ -package stirling.software.SPDF.controller; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; - -@Controller -public class PageManagerController { - - private static final Logger logger = LoggerFactory.getLogger(PageManagerController.class); - - @GetMapping("/page-manager") - public String hello(Model model) { - model.addAttribute("currentPage", "page-manager"); - return "page-manager"; - } - -} \ No newline at end of file diff --git a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java index 4ab33e60..f1f05c83 100644 --- a/src/main/java/stirling/software/SPDF/utils/PdfUtils.java +++ b/src/main/java/stirling/software/SPDF/utils/PdfUtils.java @@ -31,9 +31,13 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.multipart.MultipartFile; -import com.itextpdf.text.Document; -import com.itextpdf.text.DocumentException; -import com.itextpdf.text.pdf.PdfWriter; +import java.io.InputStream; +import java.security.KeyPair; +import java.security.KeyStore; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; public class PdfUtils { @@ -219,18 +223,7 @@ public class PdfUtils { return baos.toByteArray(); } - public static ResponseEntity iTextDocToWebResponse(Document document, String docName) throws IOException, DocumentException { - // Close the document - document.close(); - - // Open Byte Array and save document to it - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PdfWriter.getInstance(document, baos).close(); - - return PdfUtils.boasToWebResponse(baos, docName); - } - public static ResponseEntity pdfDocToWebResponse(PDDocument document, String docName) throws IOException { @@ -258,4 +251,32 @@ public class PdfUtils { headers.setContentDispositionFormData("attachment", docName); return new ResponseEntity<>(bytes, headers, HttpStatus.OK); } + + + public static KeyPair loadKeyPairFromKeystore(InputStream keystoreInputStream, String keystorePassword) throws Exception { + KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); + keystore.load(keystoreInputStream, keystorePassword.toCharArray()); + + String alias = keystore.aliases().nextElement(); + PrivateKey privateKey = (PrivateKey) keystore.getKey(alias, keystorePassword.toCharArray()); + Certificate cert = keystore.getCertificate(alias); + PublicKey publicKey = cert.getPublicKey(); + + return new KeyPair(publicKey, privateKey); + } + + public static X509Certificate[] loadCertificateChainFromKeystore(InputStream keystoreInputStream, String keystorePassword) throws Exception { + KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); + keystore.load(keystoreInputStream, keystorePassword.toCharArray()); + + String alias = keystore.aliases().nextElement(); + Certificate[] certChain = keystore.getCertificateChain(alias); + X509Certificate[] x509CertChain = new X509Certificate[certChain.length]; + + for (int i = 0; i < certChain.length; i++) { + x509CertChain[i] = (X509Certificate) certChain[i]; + } + + return x509CertChain; + } } diff --git a/src/main/resources/messages_en_GB.properties b/src/main/resources/messages_en_GB.properties index 2a63b014..6e9ee7cd 100644 --- a/src/main/resources/messages_en_GB.properties +++ b/src/main/resources/messages_en_GB.properties @@ -23,7 +23,7 @@ close=Close ############# home.desc=Your locally hosted one-stop-shop for all your PDF needs. -navbar.pages=Pages +navbar.pageOps=Page Operations navbar.convert=Convert navbar.security=Security navbar.other=Other @@ -47,8 +47,8 @@ home.pdfToImage.desc=Convert a PDF to a image. (PNG, JPEG, GIF) home.pdfOrganiser.title=Organise home.pdfOrganiser.desc=Remove/Rearrange pages in any order -home.pageManager.title=Page Manager -home.pageManager.desc=Merge, Rotate, Rearrange, and Remove pages +home.multiTool.title=PDF Multi Tool +home.multiTool.desc=Merge, Rotate, Rearrange, and Remove pages home.addImage.title=Add image onto PDF home.addImage.desc=Adds a image onto a set location on the PDF (Work in progress) @@ -183,9 +183,9 @@ pdfOrganiser.title=Page Organiser pdfOrganiser.header=PDF Page Organiser pdfOrganiser.submit=Rearrange Pages -#pageManager -pageManager.title=Page Manager -pageManager.header=PDF Page Manager +#multiTool +multiTool.title=PDF Multi Tool +multiTool.header=PDF Multi Tool #pageRemover diff --git a/src/main/resources/static/images/Files.svg b/src/main/resources/static/images/Files.svg new file mode 100644 index 00000000..a779353b --- /dev/null +++ b/src/main/resources/static/images/Files.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/main/resources/static/images/arrow-clockwise.svg b/src/main/resources/static/images/arrow-clockwise.svg new file mode 100644 index 00000000..b072eb09 --- /dev/null +++ b/src/main/resources/static/images/arrow-clockwise.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/arrow-left-right.svg b/src/main/resources/static/images/arrow-left-right.svg new file mode 100644 index 00000000..8aabd7be --- /dev/null +++ b/src/main/resources/static/images/arrow-left-right.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/arrow-right-short.svg b/src/main/resources/static/images/arrow-right-short.svg new file mode 100644 index 00000000..4626398c --- /dev/null +++ b/src/main/resources/static/images/arrow-right-short.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/clipboard-data.svg b/src/main/resources/static/images/clipboard-data.svg new file mode 100644 index 00000000..b4fcb336 --- /dev/null +++ b/src/main/resources/static/images/clipboard-data.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/droplet.svg b/src/main/resources/static/images/droplet.svg new file mode 100644 index 00000000..2b405d68 --- /dev/null +++ b/src/main/resources/static/images/droplet.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-earmark-pdf.svg b/src/main/resources/static/images/file-earmark-pdf.svg new file mode 100644 index 00000000..52da96fe --- /dev/null +++ b/src/main/resources/static/images/file-earmark-pdf.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-earmark-ppt.svg b/src/main/resources/static/images/file-earmark-ppt.svg new file mode 100644 index 00000000..bedf5526 --- /dev/null +++ b/src/main/resources/static/images/file-earmark-ppt.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-earmark-richtext.svg b/src/main/resources/static/images/file-earmark-richtext.svg new file mode 100644 index 00000000..35af1467 --- /dev/null +++ b/src/main/resources/static/images/file-earmark-richtext.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-earmark-word.svg b/src/main/resources/static/images/file-earmark-word.svg new file mode 100644 index 00000000..7186b69e --- /dev/null +++ b/src/main/resources/static/images/file-earmark-word.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-earmark-x.svg b/src/main/resources/static/images/file-earmark-x.svg new file mode 100644 index 00000000..bedb970d --- /dev/null +++ b/src/main/resources/static/images/file-earmark-x.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-pdf.svg b/src/main/resources/static/images/file-pdf.svg new file mode 100644 index 00000000..e8ba0a15 --- /dev/null +++ b/src/main/resources/static/images/file-pdf.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file-zip.svg b/src/main/resources/static/images/file-zip.svg new file mode 100644 index 00000000..3da93c8c --- /dev/null +++ b/src/main/resources/static/images/file-zip.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/file.svg b/src/main/resources/static/images/file.svg new file mode 100644 index 00000000..c3d086b9 --- /dev/null +++ b/src/main/resources/static/images/file.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/filetype-html.svg b/src/main/resources/static/images/filetype-html.svg new file mode 100644 index 00000000..35d72185 --- /dev/null +++ b/src/main/resources/static/images/filetype-html.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/filetype-txt.svg b/src/main/resources/static/images/filetype-txt.svg new file mode 100644 index 00000000..6fae02a0 --- /dev/null +++ b/src/main/resources/static/images/filetype-txt.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/filetype-xml.svg b/src/main/resources/static/images/filetype-xml.svg new file mode 100644 index 00000000..d8226455 --- /dev/null +++ b/src/main/resources/static/images/filetype-xml.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/flags/ar.svg b/src/main/resources/static/images/flags/ar.svg new file mode 100644 index 00000000..d1810f25 --- /dev/null +++ b/src/main/resources/static/images/flags/ar.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/static/images/flags/de.svg b/src/main/resources/static/images/flags/de.svg new file mode 100644 index 00000000..b08334b6 --- /dev/null +++ b/src/main/resources/static/images/flags/de.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/static/images/flags/es.svg b/src/main/resources/static/images/flags/es.svg new file mode 100644 index 00000000..815e0f84 --- /dev/null +++ b/src/main/resources/static/images/flags/es.svg @@ -0,0 +1,544 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/static/images/flags/fr.svg b/src/main/resources/static/images/flags/fr.svg new file mode 100644 index 00000000..79689fe9 --- /dev/null +++ b/src/main/resources/static/images/flags/fr.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/main/resources/static/images/flags/gb.svg b/src/main/resources/static/images/flags/gb.svg new file mode 100644 index 00000000..dbac25ea --- /dev/null +++ b/src/main/resources/static/images/flags/gb.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/main/resources/static/images/gear.svg b/src/main/resources/static/images/gear.svg new file mode 100644 index 00000000..c11dbc1d --- /dev/null +++ b/src/main/resources/static/images/gear.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/image.svg b/src/main/resources/static/images/image.svg new file mode 100644 index 00000000..1e1964b4 --- /dev/null +++ b/src/main/resources/static/images/image.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/images.svg b/src/main/resources/static/images/images.svg new file mode 100644 index 00000000..b35ecebc --- /dev/null +++ b/src/main/resources/static/images/images.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/layout-split.svg b/src/main/resources/static/images/layout-split.svg new file mode 100644 index 00000000..71f33d2e --- /dev/null +++ b/src/main/resources/static/images/layout-split.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/lock.svg b/src/main/resources/static/images/lock.svg new file mode 100644 index 00000000..b50a68ef --- /dev/null +++ b/src/main/resources/static/images/lock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/search.svg b/src/main/resources/static/images/search.svg new file mode 100644 index 00000000..d3dc7ca1 --- /dev/null +++ b/src/main/resources/static/images/search.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/shield-check.svg b/src/main/resources/static/images/shield-check.svg new file mode 100644 index 00000000..ecbf5439 --- /dev/null +++ b/src/main/resources/static/images/shield-check.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/shield-lock.svg b/src/main/resources/static/images/shield-lock.svg new file mode 100644 index 00000000..ff384250 --- /dev/null +++ b/src/main/resources/static/images/shield-lock.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/sort-numeric-down.svg b/src/main/resources/static/images/sort-numeric-down.svg new file mode 100644 index 00000000..57a3fb03 --- /dev/null +++ b/src/main/resources/static/images/sort-numeric-down.svg @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/tools.svg b/src/main/resources/static/images/tools.svg new file mode 100644 index 00000000..fcc8362f --- /dev/null +++ b/src/main/resources/static/images/tools.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/trash.svg b/src/main/resources/static/images/trash.svg new file mode 100644 index 00000000..4d0ee364 --- /dev/null +++ b/src/main/resources/static/images/trash.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/main/resources/static/images/union.svg b/src/main/resources/static/images/union.svg new file mode 100644 index 00000000..b629b881 --- /dev/null +++ b/src/main/resources/static/images/union.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/static/images/unlock.svg b/src/main/resources/static/images/unlock.svg new file mode 100644 index 00000000..8eb0925d --- /dev/null +++ b/src/main/resources/static/images/unlock.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/src/main/resources/templates/fragments/navbar.html b/src/main/resources/templates/fragments/navbar.html index a2b1d4ca..eabf638e 100644 --- a/src/main/resources/templates/fragments/navbar.html +++ b/src/main/resources/templates/fragments/navbar.html @@ -74,6 +74,39 @@ function compareVersions(version1, version2) { checkForUpdate(); +