mirror of
				https://github.com/Frooodle/Stirling-PDF.git
				synced 2025-11-01 01:21:18 +01:00 
			
		
		
		
	PDF security features (#26)
- Support for adding and removing passwords - Support for watermarks - Dedicated page remover - Support for PDF permissions - Removed endpoint /home and replaced with / - Code cleanups - Fixed page titles
This commit is contained in:
		
							parent
							
								
									1937a83531
								
							
						
					
					
						commit
						5275866f09
					
				@ -19,6 +19,9 @@ I will support and fix/add things to this if there is a demand [Discord](https:/
 | 
			
		||||
- Add images to PDFs at specified locations.
 | 
			
		||||
- Rotating PDFs in 90 degree increments.
 | 
			
		||||
- Compressing PDFs to decrease their filesize.
 | 
			
		||||
- Add and remove passwords
 | 
			
		||||
- Set PDF Permissions
 | 
			
		||||
- Add watermark(s)
 | 
			
		||||
- Dark mode support.
 | 
			
		||||
 | 
			
		||||
## Technologies used
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ plugins {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
group = 'stirling.software'
 | 
			
		||||
version = '0.2.3'
 | 
			
		||||
version = '0.3.0'
 | 
			
		||||
sourceCompatibility = '17'
 | 
			
		||||
 | 
			
		||||
repositories {
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ import com.spire.pdf.exporting.PdfImageInfo;
 | 
			
		||||
import com.spire.pdf.graphics.PdfBitmap;
 | 
			
		||||
 | 
			
		||||
import stirling.software.SPDF.utils.PdfUtils;
 | 
			
		||||
 | 
			
		||||
//import com.spire.pdf.*;
 | 
			
		||||
@Controller
 | 
			
		||||
public class CompressController {
 | 
			
		||||
@ -41,16 +42,15 @@ public class CompressController {
 | 
			
		||||
	public ResponseEntity<byte[]> compressPDF(@RequestParam("fileInput") MultipartFile pdfFile,
 | 
			
		||||
			@RequestParam("imageCompressionLevel") String imageCompressionLevel) throws IOException {
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		//Load a sample PDF document
 | 
			
		||||
		// Load a sample PDF document
 | 
			
		||||
		PdfDocument document = new PdfDocument();
 | 
			
		||||
		document.loadFromBytes(pdfFile.getBytes());
 | 
			
		||||
 | 
			
		||||
        //Compress PDF
 | 
			
		||||
		// Compress PDF
 | 
			
		||||
		document.getFileInfo().setIncrementalUpdate(false);
 | 
			
		||||
		document.setCompressionLevel(PdfCompressionLevel.Best);
 | 
			
		||||
 | 
			
		||||
        //compress PDF Images
 | 
			
		||||
		// compress PDF Images
 | 
			
		||||
		for (int i = 0; i < document.getPages().getCount(); i++) {
 | 
			
		||||
 | 
			
		||||
			PdfPageBase page = document.getPages().get(i);
 | 
			
		||||
@ -59,7 +59,7 @@ public class CompressController {
 | 
			
		||||
				for (int j = 0; j < images.length; j++) {
 | 
			
		||||
					PdfImageInfo image = images[j];
 | 
			
		||||
					PdfBitmap bp = new PdfBitmap(image.getImage());
 | 
			
		||||
                    //bp.setPngDirectToJpeg(true);
 | 
			
		||||
					// bp.setPngDirectToJpeg(true);
 | 
			
		||||
					bp.setQuality(Integer.valueOf(imageCompressionLevel));
 | 
			
		||||
 | 
			
		||||
					page.replaceImage(j, bp);
 | 
			
		||||
@ -67,21 +67,8 @@ public class CompressController {
 | 
			
		||||
				}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
     // Save the rearranged PDF to a ByteArrayOutputStream
 | 
			
		||||
	ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
 | 
			
		||||
	document.saveToStream(outputStream);
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, pdfFile.getName() + "_compressed.pdf");
 | 
			
		||||
 | 
			
		||||
	// Close the original document
 | 
			
		||||
	document.close();
 | 
			
		||||
 | 
			
		||||
	// Prepare the response headers
 | 
			
		||||
	HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
	headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
	headers.setContentDispositionFormData("attachment", "compressed.pdf");
 | 
			
		||||
	headers.setContentLength(outputStream.size());
 | 
			
		||||
 | 
			
		||||
	// Return the response with the PDF data and headers
 | 
			
		||||
	return new ResponseEntity<>(outputStream.toByteArray(), headers, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,77 @@
 | 
			
		||||
package stirling.software.SPDF.controller;
 | 
			
		||||
 | 
			
		||||
import java.io.ByteArrayInputStream;
 | 
			
		||||
import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDDocument;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDPage;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDPageTree;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.core.io.InputStreamResource;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.ui.Model;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class MergeController {
 | 
			
		||||
 | 
			
		||||
	private static final Logger logger = LoggerFactory.getLogger(MergeController.class);
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/merge-pdfs")
 | 
			
		||||
	public String hello(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "merge-pdfs");
 | 
			
		||||
		return "merge-pdfs";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/merge-pdfs")
 | 
			
		||||
	public ResponseEntity<InputStreamResource> mergePdfs(@RequestParam("fileInput") MultipartFile[] files)
 | 
			
		||||
			throws IOException {
 | 
			
		||||
		// Read the input PDF files into PDDocument objects
 | 
			
		||||
		List<PDDocument> documents = new ArrayList<>();
 | 
			
		||||
 | 
			
		||||
		// Loop through the files array and read each file into a PDDocument
 | 
			
		||||
		for (MultipartFile file : files) {
 | 
			
		||||
			documents.add(PDDocument.load(file.getInputStream()));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		PDDocument mergedDoc = mergeDocuments(documents);
 | 
			
		||||
		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
 | 
			
		||||
		mergedDoc.save(byteArrayOutputStream);
 | 
			
		||||
		mergedDoc.close();
 | 
			
		||||
 | 
			
		||||
		// Create an InputStreamResource from the merged PDF
 | 
			
		||||
		InputStreamResource resource = new InputStreamResource(
 | 
			
		||||
				new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
 | 
			
		||||
 | 
			
		||||
		// Return the merged PDF as a response
 | 
			
		||||
		return ResponseEntity.ok().contentType(MediaType.APPLICATION_PDF).body(resource);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private PDDocument mergeDocuments(List<PDDocument> documents) throws IOException {
 | 
			
		||||
		// Create a new empty document
 | 
			
		||||
		PDDocument mergedDoc = new PDDocument();
 | 
			
		||||
 | 
			
		||||
		// Iterate over the list of documents and add their pages to the merged document
 | 
			
		||||
		for (PDDocument doc : documents) {
 | 
			
		||||
			// Get all pages from the current document
 | 
			
		||||
			PDPageTree pages = doc.getPages();
 | 
			
		||||
			// Iterate over the pages and add them to the merged document
 | 
			
		||||
			for (PDPage page : pages) {
 | 
			
		||||
				mergedDoc.addPage(page);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Return the merged document
 | 
			
		||||
		return mergedDoc;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -36,11 +36,8 @@ public class OverlayImageController {
 | 
			
		||||
			byte[] pdfBytes = pdfFile.getBytes();
 | 
			
		||||
			byte[] imageBytes = imageFile.getBytes();
 | 
			
		||||
			byte[] result = PdfUtils.overlayImage(pdfBytes, imageBytes, x, y);
 | 
			
		||||
			HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
			headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
			headers.setContentDispositionFormData("attachment", "overlayed.pdf");
 | 
			
		||||
			headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
 | 
			
		||||
			return new ResponseEntity<>(result, headers, HttpStatus.OK);
 | 
			
		||||
 | 
			
		||||
			return PdfUtils.bytesToWebResponse(result, pdfFile.getName() + "_overlayed.pdf");
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
			logger.error("Failed to add image to PDF", e);
 | 
			
		||||
			return new ResponseEntity<>(HttpStatus.BAD_REQUEST);
 | 
			
		||||
 | 
			
		||||
@ -26,63 +26,18 @@ public class PdfController {
 | 
			
		||||
 | 
			
		||||
	private static final Logger logger = LoggerFactory.getLogger(PdfController.class);
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/")
 | 
			
		||||
	public String root(Model model) {
 | 
			
		||||
		return "redirect:/home";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/merge-pdfs")
 | 
			
		||||
	public String hello(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "merge-pdfs");
 | 
			
		||||
		return "merge-pdfs";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/home")
 | 
			
		||||
	public String root(Model model) {
 | 
			
		||||
		return "redirect:/";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/")
 | 
			
		||||
	public String home(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "home");
 | 
			
		||||
		return "home";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/merge-pdfs")
 | 
			
		||||
	public ResponseEntity<InputStreamResource> mergePdfs(@RequestParam("fileInput") MultipartFile[] files)
 | 
			
		||||
			throws IOException {
 | 
			
		||||
		// Read the input PDF files into PDDocument objects
 | 
			
		||||
		List<PDDocument> documents = new ArrayList<>();
 | 
			
		||||
	
 | 
			
		||||
		// Loop through the files array and read each file into a PDDocument
 | 
			
		||||
		for (MultipartFile file : files) {
 | 
			
		||||
			documents.add(PDDocument.load(file.getInputStream()));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		PDDocument mergedDoc = mergeDocuments(documents);
 | 
			
		||||
		ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
 | 
			
		||||
		mergedDoc.save(byteArrayOutputStream);
 | 
			
		||||
		mergedDoc.close();
 | 
			
		||||
 | 
			
		||||
		// Create an InputStreamResource from the merged PDF
 | 
			
		||||
		InputStreamResource resource = new InputStreamResource(
 | 
			
		||||
				new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
 | 
			
		||||
 | 
			
		||||
		// Return the merged PDF as a response
 | 
			
		||||
		return ResponseEntity.ok().contentType(MediaType.APPLICATION_PDF).body(resource);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private PDDocument mergeDocuments(List<PDDocument> documents) throws IOException {
 | 
			
		||||
		// Create a new empty document
 | 
			
		||||
		PDDocument mergedDoc = new PDDocument();
 | 
			
		||||
 | 
			
		||||
		// Iterate over the list of documents and add their pages to the merged document
 | 
			
		||||
		for (PDDocument doc : documents) {
 | 
			
		||||
			// Get all pages from the current document
 | 
			
		||||
			PDPageTree pages = doc.getPages();
 | 
			
		||||
			// Iterate over the pages and add them to the merged document
 | 
			
		||||
			for (PDPage page : pages) {
 | 
			
		||||
				mergedDoc.addPage(page);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Return the merged document
 | 
			
		||||
		return mergedDoc;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
 | 
			
		||||
import stirling.software.SPDF.utils.PdfUtils;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class RearrangePagesPDFController {
 | 
			
		||||
 | 
			
		||||
@ -31,19 +33,34 @@ public class RearrangePagesPDFController {
 | 
			
		||||
		return "pdf-organizer";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/rearrange-pages")
 | 
			
		||||
	public ResponseEntity<byte[]> rearrangePages(@RequestParam("fileInput") MultipartFile pdfFile,
 | 
			
		||||
			@RequestParam("pageOrder") String pageOrder) {
 | 
			
		||||
		try {
 | 
			
		||||
			// Load the input PDF
 | 
			
		||||
			PDDocument document = PDDocument.load(pdfFile.getInputStream());
 | 
			
		||||
	@GetMapping("/delete-pages")
 | 
			
		||||
	public String pageDeleter(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "delete-pages");
 | 
			
		||||
		return "delete-pages";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/delete-pages")
 | 
			
		||||
	public ResponseEntity<byte[]> deletePages(@RequestParam("fileInput") MultipartFile pdfFile,
 | 
			
		||||
			@RequestParam("pagesToDelete") String pagesToDelete) throws IOException {
 | 
			
		||||
		
 | 
			
		||||
		PDDocument document = PDDocument.load(pdfFile.getBytes());
 | 
			
		||||
		 
 | 
			
		||||
		// Split the page order string into an array of page numbers or range of numbers
 | 
			
		||||
			String[] pageOrderArr = pageOrder.split(",");
 | 
			
		||||
			List<Integer> newPageOrder = new ArrayList<Integer>();
 | 
			
		||||
			//int[] newPageOrder = new int[pageOrderArr.length];
 | 
			
		||||
			int totalPages = document.getNumberOfPages();
 | 
			
		||||
		String[] pageOrderArr = pagesToDelete.split(",");
 | 
			
		||||
					
 | 
			
		||||
		List<Integer> pagesToRemove = pageOrderToString(pageOrderArr, document.getNumberOfPages());
 | 
			
		||||
		
 | 
			
		||||
		for (int i = pagesToRemove.size() - 1; i >= 0; i--) {
 | 
			
		||||
		      int pageIndex = pagesToRemove.get(i);
 | 
			
		||||
		      document.removePage(pageIndex);
 | 
			
		||||
		    }
 | 
			
		||||
		
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, pdfFile.getName() + "_removed_pages.pdf");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private List<Integer> pageOrderToString(String[] pageOrderArr, int totalPages) {
 | 
			
		||||
		List<Integer> newPageOrder = new ArrayList<Integer>();
 | 
			
		||||
		// loop through the page order array
 | 
			
		||||
		for (String element : pageOrderArr) {
 | 
			
		||||
			// check if the element contains a range of pages
 | 
			
		||||
@ -59,14 +76,31 @@ public class RearrangePagesPDFController {
 | 
			
		||||
				// loop through the range of pages
 | 
			
		||||
				for (int j = start; j <= end; j++) {
 | 
			
		||||
					// print the current index
 | 
			
		||||
						newPageOrder.add( j - 1);
 | 
			
		||||
					newPageOrder.add(j - 1);
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				// if the element is a single page
 | 
			
		||||
					newPageOrder.add( Integer.parseInt(element) - 1);
 | 
			
		||||
				newPageOrder.add(Integer.parseInt(element) - 1);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		return newPageOrder;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/rearrange-pages")
 | 
			
		||||
	public ResponseEntity<byte[]> rearrangePages(@RequestParam("fileInput") MultipartFile pdfFile,
 | 
			
		||||
			@RequestParam("pageOrder") String pageOrder) {
 | 
			
		||||
		try {
 | 
			
		||||
			// Load the input PDF
 | 
			
		||||
			PDDocument document = PDDocument.load(pdfFile.getInputStream());
 | 
			
		||||
 | 
			
		||||
			// Split the page order string into an array of page numbers or range of numbers
 | 
			
		||||
			String[] pageOrderArr = pageOrder.split(",");
 | 
			
		||||
			// int[] newPageOrder = new int[pageOrderArr.length];
 | 
			
		||||
			int totalPages = document.getNumberOfPages();
 | 
			
		||||
 | 
			
		||||
			List<Integer> newPageOrder = pageOrderToString(pageOrderArr, totalPages);
 | 
			
		||||
			
 | 
			
		||||
			// Create a new list to hold the pages in the new order
 | 
			
		||||
			List<PDPage> newPages = new ArrayList<>();
 | 
			
		||||
			for (int i = 0; i < newPageOrder.size(); i++) {
 | 
			
		||||
@ -83,21 +117,7 @@ public class RearrangePagesPDFController {
 | 
			
		||||
				document.addPage(page);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// Save the rearranged PDF to a ByteArrayOutputStream
 | 
			
		||||
			ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
 | 
			
		||||
			document.save(outputStream);
 | 
			
		||||
 | 
			
		||||
			// Close the original document
 | 
			
		||||
			document.close();
 | 
			
		||||
 | 
			
		||||
			// Prepare the response headers
 | 
			
		||||
			HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
			headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
			headers.setContentDispositionFormData("attachment", "rearranged.pdf");
 | 
			
		||||
			headers.setContentLength(outputStream.size());
 | 
			
		||||
 | 
			
		||||
			// Return the response with the PDF data and headers
 | 
			
		||||
			return new ResponseEntity<>(outputStream.toByteArray(), headers, HttpStatus.OK);
 | 
			
		||||
			return PdfUtils.pdfDocToWebResponse(document, pdfFile.getName() + "_rearranged.pdf");
 | 
			
		||||
		} catch (IOException e) {
 | 
			
		||||
 | 
			
		||||
			logger.error("Failed rearranging documents", e);
 | 
			
		||||
 | 
			
		||||
@ -53,21 +53,7 @@ public class RotationController {
 | 
			
		||||
			page.setRotation(Integer.valueOf(angle));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// Save the rearranged PDF to a ByteArrayOutputStream
 | 
			
		||||
		ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
 | 
			
		||||
		document.save(outputStream);
 | 
			
		||||
 | 
			
		||||
		// Close the document
 | 
			
		||||
		document.close();
 | 
			
		||||
 | 
			
		||||
		// Prepare the response headers
 | 
			
		||||
		HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
		headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
		headers.setContentDispositionFormData("attachment", "output.pdf");
 | 
			
		||||
		headers.setContentLength(outputStream.size());
 | 
			
		||||
 | 
			
		||||
		// Return the response with the PDF data and headers
 | 
			
		||||
		return new ResponseEntity<>(outputStream.toByteArray(), headers, HttpStatus.OK);
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, pdfFile.getName() + "_rotated.pdf");
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
package stirling.software.SPDF.controller;
 | 
			
		||||
package stirling.software.SPDF.controller.converters;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
@ -18,36 +18,36 @@ import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
import stirling.software.SPDF.utils.PdfUtils;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class ConvertPDFController {
 | 
			
		||||
public class ConvertImgPDFController {
 | 
			
		||||
 | 
			
		||||
	private static final Logger logger = LoggerFactory.getLogger(ConvertPDFController.class);
 | 
			
		||||
	private static final Logger logger = LoggerFactory.getLogger(ConvertImgPDFController.class);
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/convert-pdf")
 | 
			
		||||
	@GetMapping("/img-to-pdf")
 | 
			
		||||
	public String convertToPdfForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "convert-pdf");
 | 
			
		||||
		return "convert-pdf";
 | 
			
		||||
		model.addAttribute("currentPage", "img-to-pdf");
 | 
			
		||||
		return "convert/img-to-pdf";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/convert-to-pdf")
 | 
			
		||||
	@GetMapping("/pdf-to-img")
 | 
			
		||||
	public String pdfToimgForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "pdf-to-img");
 | 
			
		||||
		return "convert/pdf-to-img";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/img-to-pdf")
 | 
			
		||||
	public ResponseEntity<byte[]> convertToPdf(@RequestParam("fileInput") MultipartFile file) throws IOException {
 | 
			
		||||
		// Convert the file to PDF and get the resulting bytes
 | 
			
		||||
		byte[] bytes = PdfUtils.convertToPdf(file.getInputStream());
 | 
			
		||||
		logger.info("File {} successfully converted to pdf", file.getOriginalFilename());
 | 
			
		||||
 | 
			
		||||
		HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
		headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
		String filename = "converted.pdf";
 | 
			
		||||
		headers.setContentDispositionFormData(filename, filename);
 | 
			
		||||
		headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
 | 
			
		||||
		ResponseEntity<byte[]> response = new ResponseEntity<>(bytes, headers, HttpStatus.OK);
 | 
			
		||||
		return response;
 | 
			
		||||
		return PdfUtils.bytesToWebResponse(bytes, file.getName() + "_coverted.pdf");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/convert-from-pdf")
 | 
			
		||||
	@PostMapping("/pdf-to-img")
 | 
			
		||||
	public ResponseEntity<byte[]> convertToImage(@RequestParam("fileInput") MultipartFile file,
 | 
			
		||||
			@RequestParam("imageFormat") String imageFormat) throws IOException {
 | 
			
		||||
		byte[] pdfBytes = file.getBytes();
 | 
			
		||||
		//returns bytes for image
 | 
			
		||||
		// returns bytes for image
 | 
			
		||||
		byte[] result = PdfUtils.convertFromPdf(pdfBytes, imageFormat.toLowerCase());
 | 
			
		||||
		HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
		headers.setContentType(MediaType.parseMediaType(getMediaType(imageFormat)));
 | 
			
		||||
@ -57,11 +57,11 @@ public class ConvertPDFController {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private String getMediaType(String imageFormat) {
 | 
			
		||||
	    if(imageFormat.equalsIgnoreCase("PNG"))
 | 
			
		||||
		if (imageFormat.equalsIgnoreCase("PNG"))
 | 
			
		||||
			return "image/png";
 | 
			
		||||
	    else if(imageFormat.equalsIgnoreCase("JPEG") || imageFormat.equalsIgnoreCase("JPG"))
 | 
			
		||||
		else if (imageFormat.equalsIgnoreCase("JPEG") || imageFormat.equalsIgnoreCase("JPG"))
 | 
			
		||||
			return "image/jpeg";
 | 
			
		||||
	    else if(imageFormat.equalsIgnoreCase("GIF"))
 | 
			
		||||
		else if (imageFormat.equalsIgnoreCase("GIF"))
 | 
			
		||||
			return "image/gif";
 | 
			
		||||
		else
 | 
			
		||||
			return "application/octet-stream";
 | 
			
		||||
@ -0,0 +1,92 @@
 | 
			
		||||
package stirling.software.SPDF.controller.security;
 | 
			
		||||
 | 
			
		||||
import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.FileOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDDocument;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.encryption.AccessPermission;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.encryption.StandardDecryptionMaterial;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.ui.Model;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
 | 
			
		||||
import stirling.software.SPDF.utils.PdfUtils;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class PasswordController {
 | 
			
		||||
 | 
			
		||||
	private static final Logger logger = LoggerFactory.getLogger(PasswordController.class);
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/add-password")
 | 
			
		||||
	public String addPasswordForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "add-password");
 | 
			
		||||
		return "security/add-password";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/remove-password")
 | 
			
		||||
	public String removePasswordForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "remove-password");
 | 
			
		||||
		return "security/remove-password";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/change-permissions")
 | 
			
		||||
	public String permissionsForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "change-permissions");
 | 
			
		||||
		return "security/change-permissions";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/remove-password")
 | 
			
		||||
	public ResponseEntity<byte[]> compressPDF(@RequestParam("fileInput") MultipartFile fileInput,
 | 
			
		||||
			@RequestParam(name = "password") String password) throws IOException {
 | 
			
		||||
		PDDocument document = PDDocument.load(fileInput.getBytes(), password);
 | 
			
		||||
		document.setAllSecurityToBeRemoved(true);
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, fileInput.getName() + "_password_removed.pdf");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/add-password")
 | 
			
		||||
	public ResponseEntity<byte[]> compressPDF(@RequestParam("fileInput") MultipartFile fileInput,
 | 
			
		||||
			@RequestParam(defaultValue = "", name = "password") String password,
 | 
			
		||||
			@RequestParam(defaultValue = "128", name = "keyLength") int keyLength,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canAssembleDocument") boolean canAssembleDocument,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canExtractContent") boolean canExtractContent,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canExtractForAccessibility") boolean canExtractForAccessibility,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canFillInForm") boolean canFillInForm,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canModify") boolean canModify,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canModifyAnnotations") boolean canModifyAnnotations,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canPrint") boolean canPrint,
 | 
			
		||||
			@RequestParam(defaultValue = "false", name = "canPrintFaithful") boolean canPrintFaithful)
 | 
			
		||||
			throws IOException {
 | 
			
		||||
 | 
			
		||||
		PDDocument document = PDDocument.load(fileInput.getBytes());
 | 
			
		||||
		AccessPermission ap = new AccessPermission();
 | 
			
		||||
 | 
			
		||||
		ap.setCanAssembleDocument(!canAssembleDocument);
 | 
			
		||||
		ap.setCanExtractContent(!canExtractContent);
 | 
			
		||||
		ap.setCanExtractForAccessibility(!canExtractForAccessibility);
 | 
			
		||||
		ap.setCanFillInForm(!canFillInForm);
 | 
			
		||||
		ap.setCanModify(!canModify);
 | 
			
		||||
		ap.setCanModifyAnnotations(!canModifyAnnotations);
 | 
			
		||||
		ap.setCanPrint(!canPrint);
 | 
			
		||||
		ap.setCanPrintFaithful(!canPrintFaithful);
 | 
			
		||||
		StandardProtectionPolicy spp = new StandardProtectionPolicy(password, password, ap);
 | 
			
		||||
		spp.setEncryptionKeyLength(keyLength);
 | 
			
		||||
 | 
			
		||||
		spp.setPermissions(ap);
 | 
			
		||||
 | 
			
		||||
		document.protect(spp);
 | 
			
		||||
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, fileInput.getName() + "_passworded.pdf");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -0,0 +1,83 @@
 | 
			
		||||
package stirling.software.SPDF.controller.security;
 | 
			
		||||
 | 
			
		||||
import java.awt.Color;
 | 
			
		||||
import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDDocument;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDPage;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.PDPageContentStream;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.font.PDFont;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.font.PDType1Font;
 | 
			
		||||
import org.apache.pdfbox.pdmodel.graphics.state.PDExtendedGraphicsState;
 | 
			
		||||
import org.apache.pdfbox.util.Matrix;
 | 
			
		||||
import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
import org.springframework.stereotype.Controller;
 | 
			
		||||
import org.springframework.ui.Model;
 | 
			
		||||
import org.springframework.web.bind.annotation.GetMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.PostMapping;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestParam;
 | 
			
		||||
import org.springframework.web.multipart.MultipartFile;
 | 
			
		||||
 | 
			
		||||
import stirling.software.SPDF.utils.PdfUtils;
 | 
			
		||||
 | 
			
		||||
@Controller
 | 
			
		||||
public class WatermarkController {
 | 
			
		||||
 | 
			
		||||
	@GetMapping("/add-watermark")
 | 
			
		||||
	public String addWatermarkForm(Model model) {
 | 
			
		||||
		model.addAttribute("currentPage", "add-watermark");
 | 
			
		||||
		return "security/add-watermark";
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@PostMapping("/add-watermark")
 | 
			
		||||
	public ResponseEntity<byte[]> addWatermark(@RequestParam("pdfFile") MultipartFile pdfFile,
 | 
			
		||||
			@RequestParam("watermarkText") String watermarkText,
 | 
			
		||||
			@RequestParam(defaultValue = "30", name = "fontSize") float fontSize,
 | 
			
		||||
			@RequestParam(defaultValue = "0", name = "rotation") float rotation,
 | 
			
		||||
			@RequestParam(defaultValue = "50", name = "widthSpacer") int widthSpacer,
 | 
			
		||||
			@RequestParam(defaultValue = "50", name = "heightSpacer") int heightSpacer) throws IOException {
 | 
			
		||||
 | 
			
		||||
		// Load the input PDF
 | 
			
		||||
		PDDocument document = PDDocument.load(pdfFile.getInputStream());
 | 
			
		||||
 | 
			
		||||
		// Create a page in the document
 | 
			
		||||
		for (PDPage page : document.getPages()) {
 | 
			
		||||
			// Get the page's content stream
 | 
			
		||||
			PDPageContentStream contentStream = new PDPageContentStream(document, page,
 | 
			
		||||
					PDPageContentStream.AppendMode.APPEND, true);
 | 
			
		||||
 | 
			
		||||
			// Set font of watermark
 | 
			
		||||
			PDFont font = PDType1Font.HELVETICA_BOLD;
 | 
			
		||||
			contentStream.beginText();
 | 
			
		||||
			contentStream.setFont(font, fontSize);
 | 
			
		||||
			contentStream.setNonStrokingColor(Color.LIGHT_GRAY);
 | 
			
		||||
 | 
			
		||||
			// Set size and location of watermark
 | 
			
		||||
			float pageWidth = page.getMediaBox().getWidth();
 | 
			
		||||
			float pageHeight = page.getMediaBox().getHeight();
 | 
			
		||||
			float watermarkWidth = widthSpacer + font.getStringWidth(watermarkText) * fontSize / 1000;
 | 
			
		||||
			float watermarkHeight = heightSpacer + fontSize;
 | 
			
		||||
			int watermarkRows = (int) (pageHeight / watermarkHeight + 1);
 | 
			
		||||
			int watermarkCols = (int) (pageWidth / watermarkWidth + 1);
 | 
			
		||||
 | 
			
		||||
			// Add the watermark text
 | 
			
		||||
			for (int i = 0; i < watermarkRows; i++) {
 | 
			
		||||
				for (int j = 0; j < watermarkCols; j++) {
 | 
			
		||||
					contentStream.setTextMatrix(Matrix.getRotateInstance((float) Math.toRadians(rotation),
 | 
			
		||||
							j * watermarkWidth, i * watermarkHeight));
 | 
			
		||||
					contentStream.showTextWithPositioning(new Object[] { watermarkText });
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			contentStream.endText();
 | 
			
		||||
 | 
			
		||||
			// Close the content stream
 | 
			
		||||
			contentStream.close();
 | 
			
		||||
		}
 | 
			
		||||
		return PdfUtils.pdfDocToWebResponse(document, pdfFile.getName() + "_watermarked.pdf");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -22,6 +22,12 @@ import org.apache.pdfbox.rendering.ImageType;
 | 
			
		||||
import org.apache.pdfbox.rendering.PDFRenderer;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.http.HttpHeaders;
 | 
			
		||||
import org.springframework.http.HttpStatus;
 | 
			
		||||
import org.springframework.http.MediaType;
 | 
			
		||||
import org.springframework.http.ResponseEntity;
 | 
			
		||||
 | 
			
		||||
import com.spire.pdf.PdfDocument;
 | 
			
		||||
 | 
			
		||||
public class PdfUtils {
 | 
			
		||||
 | 
			
		||||
@ -121,4 +127,42 @@ public class PdfUtils {
 | 
			
		||||
			throw e;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static ResponseEntity<byte[]> pdfDocToWebResponse(PdfDocument document, String docName) throws IOException {
 | 
			
		||||
 | 
			
		||||
		// Open Byte Array and save document to it
 | 
			
		||||
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 | 
			
		||||
		document.saveToStream(baos);
 | 
			
		||||
		// Close the document
 | 
			
		||||
		document.close();
 | 
			
		||||
 | 
			
		||||
		return PdfUtils.boasToWebResponse(baos, docName);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static ResponseEntity<byte[]> pdfDocToWebResponse(PDDocument document, String docName) throws IOException {
 | 
			
		||||
 | 
			
		||||
		// Open Byte Array and save document to it
 | 
			
		||||
		ByteArrayOutputStream baos = new ByteArrayOutputStream();
 | 
			
		||||
		document.save(baos);
 | 
			
		||||
		// Close the document
 | 
			
		||||
		document.close();
 | 
			
		||||
 | 
			
		||||
		return PdfUtils.boasToWebResponse(baos, docName);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static ResponseEntity<byte[]> boasToWebResponse(ByteArrayOutputStream baos, String docName)
 | 
			
		||||
			throws IOException {
 | 
			
		||||
		return PdfUtils.bytesToWebResponse(baos.toByteArray(), docName);
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public static ResponseEntity<byte[]> bytesToWebResponse(byte[] bytes, String docName) throws IOException {
 | 
			
		||||
 | 
			
		||||
		// Return the PDF as a response
 | 
			
		||||
		HttpHeaders headers = new HttpHeaders();
 | 
			
		||||
		headers.setContentType(MediaType.APPLICATION_PDF);
 | 
			
		||||
		headers.setContentLength(bytes.length);
 | 
			
		||||
		headers.setContentDispositionFormData("attachment", docName);
 | 
			
		||||
		return new ResponseEntity<>(bytes, headers, HttpStatus.OK);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,14 @@
 | 
			
		||||
#footer {
 | 
			
		||||
  position: absolute;
 | 
			
		||||
  bottom: 0;
 | 
			
		||||
  width: 100%;
 | 
			
		||||
#page-container {
 | 
			
		||||
  min-height: 100vh;
 | 
			
		||||
  display: flex;
 | 
			
		||||
  flex-direction: column;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#content-wrap {
 | 
			
		||||
  flex: 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#footer {
 | 
			
		||||
bottom: 0;
 | 
			
		||||
width: 100%;
 | 
			
		||||
}
 | 
			
		||||
@ -1,19 +1,20 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF Add-Image</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Add-Image')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Add image to PDF</h2>
 | 
			
		||||
				<h2>Add image to PDF (Work in progress)</h2>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -40,12 +41,14 @@
 | 
			
		||||
					</div>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Submit</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,95 +0,0 @@
 | 
			
		||||
<head th:fragment="head">
 | 
			
		||||
	<link rel="shortcut icon" href="favicon.svg">
 | 
			
		||||
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
 | 
			
		||||
	<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
 | 
			
		||||
	<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
 | 
			
		||||
	<meta charset="UTF-8">
 | 
			
		||||
 | 
			
		||||
	<link rel="stylesheet" th:href="@{dark-mode.css}" id="dark-mode-styles">
 | 
			
		||||
	<script>
 | 
			
		||||
		function toggleDarkMode() {
 | 
			
		||||
			var checkbox = document.getElementById("toggle-dark-mode");
 | 
			
		||||
			var darkModeStyles = document.getElementById("dark-mode-styles");
 | 
			
		||||
			if (checkbox.checked) {
 | 
			
		||||
				localStorage.setItem("dark-mode", "on");
 | 
			
		||||
				darkModeStyles.disabled = false;
 | 
			
		||||
			} else {
 | 
			
		||||
				localStorage.setItem("dark-mode", "off");
 | 
			
		||||
				darkModeStyles.disabled = true;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		$(document).ready(function () {
 | 
			
		||||
			var darkModeStyles = document.getElementById("dark-mode-styles");
 | 
			
		||||
			var checkbox = document.getElementById("toggle-dark-mode");
 | 
			
		||||
			if (localStorage.getItem("dark-mode") == "on") {
 | 
			
		||||
				darkModeStyles.disabled = false;
 | 
			
		||||
				checkbox.checked = true;
 | 
			
		||||
			}
 | 
			
		||||
			if (localStorage.getItem("dark-mode") == "off") {
 | 
			
		||||
				darkModeStyles.disabled = true;
 | 
			
		||||
				checkbox.checked = false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		});
 | 
			
		||||
	</script>
 | 
			
		||||
	<link rel="stylesheet" href="general.css">
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<th:block th:fragment="filelist">
 | 
			
		||||
	<div id="fileList"></div>
 | 
			
		||||
	<div id="fileList2"></div>
 | 
			
		||||
	<script>
 | 
			
		||||
		var input = document.getElementById("fileInput");
 | 
			
		||||
		var output = document.getElementById("fileList");
 | 
			
		||||
 | 
			
		||||
		input.addEventListener("change", function () {
 | 
			
		||||
			var files = input.files;
 | 
			
		||||
			var fileNames = "";
 | 
			
		||||
 | 
			
		||||
			for (var i = 0; i < files.length; i++) {
 | 
			
		||||
				fileNames += (i + 1) + ". " + files[i].name + "<br>";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			output.innerHTML = fileNames;
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
	</script>
 | 
			
		||||
	<script>
 | 
			
		||||
		var input2 = document.getElementById("fileInput2");
 | 
			
		||||
		var output2 = document.getElementById("fileList2");
 | 
			
		||||
		if (input2 != null && !input2) {
 | 
			
		||||
			input2.addEventListener("change", function () {
 | 
			
		||||
				var files = input2.files;
 | 
			
		||||
				var fileNames = "";
 | 
			
		||||
 | 
			
		||||
				for (var i = 0; i < files.length; i++) {
 | 
			
		||||
					fileNames += (i + 1) + ". " + files[i].name + "<br>";
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				output2.innerHTML = fileNames;
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	<script>
 | 
			
		||||
		if (dropContainer) {
 | 
			
		||||
			dropContainer.ondragover = dropContainer.ondragenter = function (evt) {
 | 
			
		||||
				evt.preventDefault();
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			dropContainer.ondrop = function (evt) {
 | 
			
		||||
				if(fileInput) {
 | 
			
		||||
					fileInput.files = evt.dataTransfer.files;
 | 
			
		||||
	
 | 
			
		||||
					const dT = new DataTransfer();
 | 
			
		||||
					dT.items.add(evt.dataTransfer.files[0]);
 | 
			
		||||
					dT.items.add(evt.dataTransfer.files[3]);
 | 
			
		||||
					fileInput.files = dT.files;
 | 
			
		||||
	
 | 
			
		||||
					evt.preventDefault();
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
		}
 | 
			
		||||
	</script>
 | 
			
		||||
</th:block>
 | 
			
		||||
@ -1,43 +1,46 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF Add-Image</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Compress')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Compress PDF</h2>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				
 | 
			
		||||
				<form action="#" th:action="@{compress-pdf}" th:object="${rotateForm}"
 | 
			
		||||
					method="post" enctype="multipart/form-data">
 | 
			
		||||
					<p>Warning: This process can take up to a minute depending on file-size</p>
 | 
			
		||||
				<form action="#" th:action="@{compress-pdf}"
 | 
			
		||||
					th:object="${rotateForm}" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
					<p>Warning: This process can take up to a minute depending on
 | 
			
		||||
						file-size</p>
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose PDF</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label for="imageCompressionLevel">Value between 1 and 100 (1 being most reduced)</label> <input type="number" class="form-control"
 | 
			
		||||
							id="imageCompressionLevel" name="imageCompressionLevel" step="1" value="1" min="1" max="100" required>
 | 
			
		||||
						<label for="imageCompressionLevel">Value between 1 and 100
 | 
			
		||||
							(1 being most reduced)</label> <input type="number" class="form-control"
 | 
			
		||||
							id="imageCompressionLevel" name="imageCompressionLevel" step="1"
 | 
			
		||||
							value="1" min="1" max="100" required>
 | 
			
		||||
					</div>
 | 
			
		||||
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Compress</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,61 +0,0 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF ConvertToPDF</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Image to PDF</h2>
 | 
			
		||||
 | 
			
		||||
				<form method="post" enctype="multipart/form-data"
 | 
			
		||||
					th:action="@{convert-to-pdf}">
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose Image</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<br><br>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Convert</button>
 | 
			
		||||
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<br><br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>PDF to img</h2>
 | 
			
		||||
				<form method="post" enctype="multipart/form-data"
 | 
			
		||||
					th:action="@{convert-from-pdf}">
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose PDF</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Image Format</label> <select class="form-control"
 | 
			
		||||
							name="imageFormat">
 | 
			
		||||
							<option value="jpg">JPEG</option>
 | 
			
		||||
							<option value="png">PNG</option>
 | 
			
		||||
							<option value="gif">GIF</option>
 | 
			
		||||
						</select>
 | 
			
		||||
					</div>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Convert</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										38
									
								
								src/main/resources/templates/convert/img-to-pdf.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/main/resources/templates/convert/img-to-pdf.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Image to PDF')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Image to PDF</h2>
 | 
			
		||||
 | 
			
		||||
				<form method="post" enctype="multipart/form-data"
 | 
			
		||||
					th:action="@{img-to-pdf}">
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose Image</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<br>
 | 
			
		||||
					<br>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Convert</button>
 | 
			
		||||
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										43
									
								
								src/main/resources/templates/convert/pdf-to-img.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								src/main/resources/templates/convert/pdf-to-img.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,43 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='PDF to Image')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>PDF to Image</h2>
 | 
			
		||||
				<form method="post" enctype="multipart/form-data"
 | 
			
		||||
					th:action="@{pdf-to-img}">
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose PDF</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Image Format</label> <select class="form-control"
 | 
			
		||||
							name="imageFormat">
 | 
			
		||||
							<option value="jpg">JPEG</option>
 | 
			
		||||
							<option value="png">PNG</option>
 | 
			
		||||
							<option value="gif">GIF</option>
 | 
			
		||||
						</select>
 | 
			
		||||
					</div>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Convert</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										42
									
								
								src/main/resources/templates/delete-pages.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								src/main/resources/templates/delete-pages.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,42 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Page Remover')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>PDF Page remover</h2>
 | 
			
		||||
 | 
			
		||||
				<form th:action="@{delete-pages}" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
					<div class="custom-file">
 | 
			
		||||
						<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
							name="fileInput" required> <label
 | 
			
		||||
							class="custom-file-label" for="fileInput">Choose PDF</label>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label for="pagesToDelete">Pages to delete (Enter a comma-separated
 | 
			
		||||
							list of page numbers) :</label> <input type="text" class="form-control"
 | 
			
		||||
							id="fileInput" name="pagesToDelete"
 | 
			
		||||
							placeholder="(e.g. 1,2,6 or 1-10,15-30)" required>
 | 
			
		||||
					</div>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Delete
 | 
			
		||||
						Pages</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										9
									
								
								src/main/resources/templates/fragments/card.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								src/main/resources/templates/fragments/card.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,9 @@
 | 
			
		||||
<div th:fragment="card"  class="col-4 h-100">
 | 
			
		||||
	<div class="dark-card card">
 | 
			
		||||
		<div class="card-body">
 | 
			
		||||
			<h5 class="card-title" th:text="${cardTitle}"></h5>
 | 
			
		||||
			<p class="card-text" th:text="${cardText}"></p>
 | 
			
		||||
			<a class="btn btn-primary" th:href="${cardLink}">Go</a>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>
 | 
			
		||||
							
								
								
									
										98
									
								
								src/main/resources/templates/fragments/common.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										98
									
								
								src/main/resources/templates/fragments/common.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,98 @@
 | 
			
		||||
<head th:fragment="head">
 | 
			
		||||
<link rel="shortcut icon" href="favicon.svg">
 | 
			
		||||
<script
 | 
			
		||||
	src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
 | 
			
		||||
<link rel="stylesheet"
 | 
			
		||||
	href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
 | 
			
		||||
<script
 | 
			
		||||
	src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
 | 
			
		||||
<meta charset="UTF-8">
 | 
			
		||||
 | 
			
		||||
<link rel="stylesheet" th:href="@{dark-mode.css}" id="dark-mode-styles">
 | 
			
		||||
<script>
 | 
			
		||||
	function toggleDarkMode() {
 | 
			
		||||
		var checkbox = document.getElementById("toggle-dark-mode");
 | 
			
		||||
		var darkModeStyles = document.getElementById("dark-mode-styles");
 | 
			
		||||
		if (checkbox.checked) {
 | 
			
		||||
			localStorage.setItem("dark-mode", "on");
 | 
			
		||||
			darkModeStyles.disabled = false;
 | 
			
		||||
		} else {
 | 
			
		||||
			localStorage.setItem("dark-mode", "off");
 | 
			
		||||
			darkModeStyles.disabled = true;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	$(document).ready(function() {
 | 
			
		||||
		var darkModeStyles = document.getElementById("dark-mode-styles");
 | 
			
		||||
		var checkbox = document.getElementById("toggle-dark-mode");
 | 
			
		||||
		if (localStorage.getItem("dark-mode") == "on") {
 | 
			
		||||
			darkModeStyles.disabled = false;
 | 
			
		||||
			checkbox.checked = true;
 | 
			
		||||
		}
 | 
			
		||||
		if (localStorage.getItem("dark-mode") == "off") {
 | 
			
		||||
			darkModeStyles.disabled = true;
 | 
			
		||||
			checkbox.checked = false;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	});
 | 
			
		||||
</script>
 | 
			
		||||
<title th:text="'S-PDF ' + ${title}"></title>
 | 
			
		||||
<link rel="stylesheet" href="general.css">
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<th:block th:fragment="filelist">
 | 
			
		||||
	<div id="fileList"></div>
 | 
			
		||||
	<div id="fileList2"></div>
 | 
			
		||||
	<script>
 | 
			
		||||
		var input = document.getElementById("fileInput");
 | 
			
		||||
		var output = document.getElementById("fileList");
 | 
			
		||||
 | 
			
		||||
		input.addEventListener("change", function() {
 | 
			
		||||
			var files = input.files;
 | 
			
		||||
			var fileNames = "";
 | 
			
		||||
 | 
			
		||||
			for (var i = 0; i < files.length; i++) {
 | 
			
		||||
				fileNames += (i + 1) + ". " + files[i].name + "<br>";
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			output.innerHTML = fileNames;
 | 
			
		||||
		});
 | 
			
		||||
	</script>
 | 
			
		||||
	<script>
 | 
			
		||||
		var input2 = document.getElementById("fileInput2");
 | 
			
		||||
		var output2 = document.getElementById("fileList2");
 | 
			
		||||
		if (input2 != null && !input2) {
 | 
			
		||||
			input2.addEventListener("change", function() {
 | 
			
		||||
				var files = input2.files;
 | 
			
		||||
				var fileNames = "";
 | 
			
		||||
 | 
			
		||||
				for (var i = 0; i < files.length; i++) {
 | 
			
		||||
					fileNames += (i + 1) + ". " + files[i].name + "<br>";
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				output2.innerHTML = fileNames;
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
	</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	<script>
 | 
			
		||||
		if (dropContainer) {
 | 
			
		||||
			dropContainer.ondragover = dropContainer.ondragenter = function(evt) {
 | 
			
		||||
				evt.preventDefault();
 | 
			
		||||
			};
 | 
			
		||||
 | 
			
		||||
			dropContainer.ondrop = function(evt) {
 | 
			
		||||
				if (fileInput) {
 | 
			
		||||
					fileInput.files = evt.dataTransfer.files;
 | 
			
		||||
 | 
			
		||||
					const dT = new DataTransfer();
 | 
			
		||||
					dT.items.add(evt.dataTransfer.files[0]);
 | 
			
		||||
					dT.items.add(evt.dataTransfer.files[3]);
 | 
			
		||||
					fileInput.files = dT.files;
 | 
			
		||||
 | 
			
		||||
					evt.preventDefault();
 | 
			
		||||
				}
 | 
			
		||||
			};
 | 
			
		||||
		}
 | 
			
		||||
	</script>
 | 
			
		||||
</th:block>
 | 
			
		||||
@ -2,8 +2,8 @@
 | 
			
		||||
	<link rel="stylesheet"
 | 
			
		||||
		href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
 | 
			
		||||
	<footer id="footer" class="text-center py-3">
 | 
			
		||||
		<a href="https://github.com/Frooodle/Stirling-PDF" target="_blank" class="mx-1">
 | 
			
		||||
			<i class="fab fa-github fa-2x"></i>
 | 
			
		||||
		<a href="https://github.com/Frooodle/Stirling-PDF" target="_blank"
 | 
			
		||||
			class="mx-1"> <i class="fab fa-github fa-2x"></i>
 | 
			
		||||
		</a> <a href="https://hub.docker.com/r/frooodle/s-pdf" target="_blank"
 | 
			
		||||
			class="mx-1"> <i class="fab fa-docker fa-2x"></i>
 | 
			
		||||
		</a>
 | 
			
		||||
							
								
								
									
										87
									
								
								src/main/resources/templates/fragments/navbar.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										87
									
								
								src/main/resources/templates/fragments/navbar.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,87 @@
 | 
			
		||||
<div th:fragment="navbar">
 | 
			
		||||
	<nav class="navbar navbar-expand-lg navbar-light bg-light">
 | 
			
		||||
		<div class="container">
 | 
			
		||||
			<a class="navbar-brand" href="#" th:href="@{/}">Stirling PDF</a>
 | 
			
		||||
			<button class="navbar-toggler" type="button" data-toggle="collapse"
 | 
			
		||||
				data-target="#navbarNav" aria-controls="navbarNav"
 | 
			
		||||
				aria-expanded="false" aria-label="Toggle navigation">
 | 
			
		||||
				<span class="navbar-toggler-icon"></span>
 | 
			
		||||
			</button>
 | 
			
		||||
			<div class="collapse navbar-collapse" id="navbarNav">
 | 
			
		||||
				<ul class="navbar-nav">
 | 
			
		||||
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{merge-pdfs}"
 | 
			
		||||
						th:classappend="${currentPage}=='merge-pdfs' ? 'active' : ''">Merge
 | 
			
		||||
							PDFs</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{split-pdfs}"
 | 
			
		||||
						th:classappend="${currentPage}=='split-pdfs' ? 'active' : ''">Split
 | 
			
		||||
							PDFs</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{pdf-organizer}"
 | 
			
		||||
						th:classappend="${currentPage}=='pdf-organizer' ? 'active' : ''">Page
 | 
			
		||||
							Organizer</a></li>		
 | 
			
		||||
							
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{rotate-pdf}"
 | 
			
		||||
						th:classappend="${currentPage}=='rotate-pdf' ? 'active' : ''">Rotate PDF</a></li>
 | 
			
		||||
						
 | 
			
		||||
						
 | 
			
		||||
						
 | 
			
		||||
								
 | 
			
		||||
					
 | 
			
		||||
					<li class="nav-item dropdown" th:classappend="${currentPage}=='pdf-to-img' OR ${currentPage}=='img-to-pdf' ? 'active' : ''">
 | 
			
		||||
												<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
			
		||||
					Convert
 | 
			
		||||
					</a>
 | 
			
		||||
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{pdf-to-img}" th:classappend="${currentPage}=='pdf-to-img' ? 'active' : ''">PDF to Image</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{img-to-pdf}" th:classappend="${currentPage}=='img-to-pdf' ? 'active' : ''">Image to PDF</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</li>
 | 
			
		||||
				
 | 
			
		||||
				<li class="nav-item dropdown" th:classappend="${currentPage}=='add-password' OR ${currentPage}=='remove-password' OR ${currentPage}=='change-permissions' OR ${currentPage}=='add-watermark' ? 'active' : ''">
 | 
			
		||||
												<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
			
		||||
					Security
 | 
			
		||||
					</a>
 | 
			
		||||
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{add-password}" th:classappend="${currentPage}=='add-password' ? 'active' : ''">Add password (Encrypt)</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{remove-password}" th:classappend="${currentPage}=='remove-password' ? 'active' : ''">Remove password (Decrypt)</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{change-permissions}" th:classappend="${currentPage}=='change-permissions' ? 'active' : ''">Change permissions</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{add-watermark}" th:classappend="${currentPage}=='add-watermark' ? 'active' : ''">Add Watermark</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</li>	
 | 
			
		||||
				
 | 
			
		||||
				<li class="nav-item dropdown" th:classappend="${currentPage}=='delete-pages' OR ${currentPage}=='add-image' OR ${currentPage}=='compress-pdf' ? 'active' : ''">
 | 
			
		||||
												<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
 | 
			
		||||
					Others
 | 
			
		||||
					</a>
 | 
			
		||||
					<div class="dropdown-menu" aria-labelledby="navbarDropdown">
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{add-image}" th:classappend="${currentPage}=='add-image' ? 'active' : ''">Add
 | 
			
		||||
							image to PDF</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{compress-pdf}" th:classappend="${currentPage}=='compress-pdf' ? 'active' : ''">Compress PDF</a>
 | 
			
		||||
						<a class="dropdown-item" href="#" th:href="@{delete-pages}" th:classappend="${currentPage}=='delete-pages' ? 'active' : ''">Remove Pages</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</li>				
 | 
			
		||||
				
 | 
			
		||||
				
 | 
			
		||||
				
 | 
			
		||||
				<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{add-image}"
 | 
			
		||||
						th:classappend="${currentPage}=='add-image' ? 'active' : ''"></a></li>
 | 
			
		||||
					
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{compress-pdf}"
 | 
			
		||||
						th:classappend="${currentPage}=='compress-pdf' ? 'active' : ''"></a></li>	
 | 
			
		||||
									
 | 
			
		||||
					<input type="checkbox" id="toggle-dark-mode" checked="true"
 | 
			
		||||
						th:onclick="javascript:toggleDarkMode()">
 | 
			
		||||
					<a class="nav-link" href="#" for="toggle-dark-mode">Dark Mode</a>
 | 
			
		||||
 | 
			
		||||
				</ul>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</nav>
 | 
			
		||||
</div>
 | 
			
		||||
@ -1,13 +1,15 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
	<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
	<title>S-PDF</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
 | 
			
		||||
	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
			<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
			<!-- Jumbotron -->
 | 
			
		||||
			<div class="jumbotron jumbotron-fluid" id="jumbotron">
 | 
			
		||||
				<div class="container">
 | 
			
		||||
@ -18,91 +20,42 @@
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<!-- Features -->
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			<div class="container">
 | 
			
		||||
				<div class="row h-100">
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Merge PDFs</h5>
 | 
			
		||||
						<p class="card-text">Easily merge multiple PDFs into one.</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{merge-pdfs}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Split PDFs</h5>
 | 
			
		||||
						<p class="card-text">Split PDFs into multiple documents</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{split-pdfs}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Add image to PDF</h5>
 | 
			
		||||
						<p class="card-text">Adds image/watermark to a PDF</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{add-image}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Merge PDFs', cardText='Easily merge multiple PDFs into one.', cardLink='merge-pdfs')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Split PDFs', cardText='Split PDFs into multiple documents', cardLink='split-pdfs')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Rotate PDFs', cardText='Easily rotate your PDFs.', cardLink='rotate-pdf')}"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
 | 
			
		||||
				<br>
 | 
			
		||||
 | 
			
		||||
				<div class="row h-100">
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Image to PDF', cardText='Convert a images (PNG, JPEG, GIF) to PDF.', cardLink='img-to-pdf')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='PDF to Image', cardText='Convert a PDF to a image. (PNG, JPEG, GIF)', cardLink='pdf-to-img')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='PDF Organizer', cardText='Remove/Rearrange pages in any order', cardLink='pdf-organizer')}"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<br>
 | 
			
		||||
				<div class="row h-100">
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Convert to/from PDF</h5>
 | 
			
		||||
						<p class="card-text">Convert images to/from PDF.</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{convert-pdf}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">PDF Organizer</h5>
 | 
			
		||||
						<p class="card-text">Remove/Rearrange pages in any order</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{pdf-organizer}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Rotate PDFs</h5>
 | 
			
		||||
						<p class="card-text">Easily rotate your PDFs.</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{rotate-pdf}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
				</div>
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Add image onto PDF', cardText='Adds a image onto a set location on the PDF (Work in progress)', cardLink='add-image')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Add Watermark', cardText='Add a custom watermark to your PDF document.', cardLink='add-watermark')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Change Permissions', cardText='Change the permissions of your PDF document, such as print, copy, edit, etc.', cardLink='change-permissions')}"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<br>
 | 
			
		||||
				<div class="row h-100">
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			<div class="col-4 h-100">
 | 
			
		||||
				<div class="dark-card card">
 | 
			
		||||
					<div class="card-body">
 | 
			
		||||
						<h5 class="card-title">Compress PDFs</h5>
 | 
			
		||||
						<p class="card-text">Compress PDFs to reduce their file size.</p>
 | 
			
		||||
						<a href="#" class="btn btn-primary" th:href="@{compress-pdf}">Go</a>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Remove Pages', cardText='Delete unwanted pages from your PDF document.', cardLink='remove-pages')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Add Password', cardText='Encrypt your PDF document with a password.', cardLink='add-password')}"></div>
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Remove Password', cardText='Remove password protection from your PDF document.', cardLink='remove-password')}"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<br>
 | 
			
		||||
				<div class="row h-100">
 | 
			
		||||
					<div th:replace="~{fragments/card :: card(cardTitle='Compress PDFs', cardText='Compress PDFs to reduce their file size.', cardLink='compress-pdf')}"></div>
 | 
			
		||||
				</div>
 | 
			
		||||
				<br>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,19 +1,17 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF MergePDFs</title>
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Merge PDFs')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container" id="dropContainer">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6" >
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Merge multiple PDFs (2+)</h2>
 | 
			
		||||
				<form action="merge-pdfs" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
@ -21,7 +19,7 @@
 | 
			
		||||
						<label>Select (or drag & drop) all PDFs to merge</label>
 | 
			
		||||
						<div class="custom-file">
 | 
			
		||||
							<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
								name="fileInput" multiple> <label
 | 
			
		||||
								name="fileInput" multiple required> <label
 | 
			
		||||
								class="custom-file-label">Choose PDFs</label>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
@ -37,38 +35,60 @@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
document.getElementById("fileInput").addEventListener("change", function() {
 | 
			
		||||
				<script>
 | 
			
		||||
					document
 | 
			
		||||
							.getElementById("fileInput")
 | 
			
		||||
							.addEventListener(
 | 
			
		||||
									"change",
 | 
			
		||||
									function() {
 | 
			
		||||
										var files = this.files;
 | 
			
		||||
    var list = document.getElementById("selectedFiles");
 | 
			
		||||
										var list = document
 | 
			
		||||
												.getElementById("selectedFiles");
 | 
			
		||||
										list.innerHTML = "";
 | 
			
		||||
										for (var i = 0; i < files.length; i++) {
 | 
			
		||||
      var item = document.createElement("li");
 | 
			
		||||
											var item = document
 | 
			
		||||
													.createElement("li");
 | 
			
		||||
											item.className = "list-group-item d-flex justify-content-between align-items-center";
 | 
			
		||||
											item.textContent = files[i].name;
 | 
			
		||||
											item.innerHTML += '<div><button class="btn btn-secondary move-up">Move Up</button> <button class="btn btn-secondary move-down">Move Down</button></div>';
 | 
			
		||||
											list.appendChild(item);
 | 
			
		||||
										}
 | 
			
		||||
    var moveUpButtons = document.querySelectorAll(".move-up");
 | 
			
		||||
										var moveUpButtons = document
 | 
			
		||||
												.querySelectorAll(".move-up");
 | 
			
		||||
										for (var i = 0; i < moveUpButtons.length; i++) {
 | 
			
		||||
      moveUpButtons[i].addEventListener("click", function(event) {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
											moveUpButtons[i]
 | 
			
		||||
													.addEventListener(
 | 
			
		||||
															"click",
 | 
			
		||||
															function(event) {
 | 
			
		||||
																event
 | 
			
		||||
																		.preventDefault();
 | 
			
		||||
																var parent = this.parentNode.parentNode;
 | 
			
		||||
																var grandParent = parent.parentNode;
 | 
			
		||||
																if (parent.previousElementSibling) {
 | 
			
		||||
          grandParent.insertBefore(parent, parent.previousElementSibling);
 | 
			
		||||
																	grandParent
 | 
			
		||||
																			.insertBefore(
 | 
			
		||||
																					parent,
 | 
			
		||||
																					parent.previousElementSibling);
 | 
			
		||||
																	updateFiles();
 | 
			
		||||
																}
 | 
			
		||||
															});
 | 
			
		||||
										}
 | 
			
		||||
    var moveDownButtons = document.querySelectorAll(".move-down");
 | 
			
		||||
										var moveDownButtons = document
 | 
			
		||||
												.querySelectorAll(".move-down");
 | 
			
		||||
										for (var i = 0; i < moveDownButtons.length; i++) {
 | 
			
		||||
      moveDownButtons[i].addEventListener("click", function(event) {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
											moveDownButtons[i]
 | 
			
		||||
													.addEventListener(
 | 
			
		||||
															"click",
 | 
			
		||||
															function(event) {
 | 
			
		||||
																event
 | 
			
		||||
																		.preventDefault();
 | 
			
		||||
																var parent = this.parentNode.parentNode;
 | 
			
		||||
																var grandParent = parent.parentNode;
 | 
			
		||||
																if (parent.nextElementSibling) {
 | 
			
		||||
          grandParent.insertBefore(parent.nextElementSibling, parent);
 | 
			
		||||
																	grandParent
 | 
			
		||||
																			.insertBefore(
 | 
			
		||||
																					parent.nextElementSibling,
 | 
			
		||||
																					parent);
 | 
			
		||||
																	updateFiles();
 | 
			
		||||
																}
 | 
			
		||||
															});
 | 
			
		||||
@ -76,24 +96,29 @@ document.getElementById("fileInput").addEventListener("change", function() {
 | 
			
		||||
 | 
			
		||||
										function updateFiles() {
 | 
			
		||||
											var dataTransfer = new DataTransfer();
 | 
			
		||||
      var liElements = document.querySelectorAll("#selectedFiles li");
 | 
			
		||||
											var liElements = document
 | 
			
		||||
													.querySelectorAll("#selectedFiles li");
 | 
			
		||||
 | 
			
		||||
											for (var i = 0; i < liElements.length; i++) {
 | 
			
		||||
    	var fileNameFromList = liElements[i].innerText.replace("\nMove Up Move Down","");
 | 
			
		||||
												var fileNameFromList = liElements[i].innerText
 | 
			
		||||
														.replace(
 | 
			
		||||
																"\nMove Up Move Down",
 | 
			
		||||
																"");
 | 
			
		||||
												var fileFromFiles
 | 
			
		||||
												for (var j = 0; j < files.length; j++) {
 | 
			
		||||
													var file = files[j];
 | 
			
		||||
        	if(file.name === fileNameFromList){
 | 
			
		||||
        		dataTransfer.items.add(file);
 | 
			
		||||
													if (file.name === fileNameFromList) {
 | 
			
		||||
														dataTransfer.items
 | 
			
		||||
																.add(file);
 | 
			
		||||
														break;
 | 
			
		||||
													}
 | 
			
		||||
												}
 | 
			
		||||
											}
 | 
			
		||||
      document.getElementById("fileInput").files = dataTransfer.files;
 | 
			
		||||
											document
 | 
			
		||||
													.getElementById("fileInput").files = dataTransfer.files;
 | 
			
		||||
										}
 | 
			
		||||
									});
 | 
			
		||||
  
 | 
			
		||||
</script>
 | 
			
		||||
				</script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -101,6 +126,8 @@ document.getElementById("fileInput").addEventListener("change", function() {
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,49 +0,0 @@
 | 
			
		||||
<div th:fragment="navbar">
 | 
			
		||||
	<nav class="navbar navbar-expand-lg navbar-light bg-light">
 | 
			
		||||
		<div class="container">
 | 
			
		||||
			<a class="navbar-brand" href="#" th:href="@{home}">Stirling PDF</a>
 | 
			
		||||
			<button class="navbar-toggler" type="button" data-toggle="collapse"
 | 
			
		||||
				data-target="#navbarNav" aria-controls="navbarNav"
 | 
			
		||||
				aria-expanded="false" aria-label="Toggle navigation">
 | 
			
		||||
				<span class="navbar-toggler-icon"></span>
 | 
			
		||||
			</button>
 | 
			
		||||
			<div class="collapse navbar-collapse" id="navbarNav">
 | 
			
		||||
				<ul class="navbar-nav">
 | 
			
		||||
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{merge-pdfs}"
 | 
			
		||||
						th:classappend="${currentPage}=='merge-pdfs' ? 'active' : ''">Merge
 | 
			
		||||
							PDFs</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{split-pdfs}"
 | 
			
		||||
						th:classappend="${currentPage}=='split-pdfs' ? 'active' : ''">Split
 | 
			
		||||
							PDFs</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{convert-pdf}"
 | 
			
		||||
						th:classappend="${currentPage}=='convert-pdf' ? 'active' : ''">Convert
 | 
			
		||||
							to/from PDF</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{add-image}"
 | 
			
		||||
						th:classappend="${currentPage}=='add-image' ? 'active' : ''">Add
 | 
			
		||||
							image to PDF</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{pdf-organizer}"
 | 
			
		||||
						th:classappend="${currentPage}=='pdf-organizer' ? 'active' : ''">PDF
 | 
			
		||||
							Organizer</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{rotate-pdf}"
 | 
			
		||||
						th:classappend="${currentPage}=='rotate-pdf' ? 'active' : ''">Rotate PDF</a></li>
 | 
			
		||||
					<li class="nav-item"><a class="nav-link" href="#"
 | 
			
		||||
						th:href="@{compress-pdf}"
 | 
			
		||||
						th:classappend="${currentPage}=='compress-pdf' ? 'active' : ''">Compress PDF</a></li>	
 | 
			
		||||
												
 | 
			
		||||
					<input type="checkbox" id="toggle-dark-mode"
 | 
			
		||||
						th:onclick="javascript:toggleDarkMode()">
 | 
			
		||||
					<a class="nav-link" href="#" for="toggle-dark-mode">Dark Mode</a>
 | 
			
		||||
 | 
			
		||||
				</ul>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</nav>
 | 
			
		||||
</div>
 | 
			
		||||
@ -1,12 +1,12 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF Organizer</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Organizer')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
@ -32,11 +32,13 @@
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Rearrange
 | 
			
		||||
						Pages</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,13 +1,13 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF Add-Image</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Rotate')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
@ -36,12 +36,14 @@
 | 
			
		||||
					</select> <br>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Rotate</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										103
									
								
								src/main/resources/templates/security/add-password.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										103
									
								
								src/main/resources/templates/security/add-password.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,103 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Add Password')}"></th:block>
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Add password (Encrypt)</h2>
 | 
			
		||||
 | 
			
		||||
				<form action="add-password" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Select PDF to encrypt</label>
 | 
			
		||||
						<div class="custom-file">
 | 
			
		||||
							<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
								name="fileInput" required> <label
 | 
			
		||||
								class="custom-file-label">Choose PDF</label>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Password</label> <input type="password"
 | 
			
		||||
							class="form-control" id="password" name="password" required>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Encryption Key Length</label> <select class="form-control"
 | 
			
		||||
							id="keyLength" name="keyLength">
 | 
			
		||||
							<option value="40">40</option>
 | 
			
		||||
							<option value="128">128</option>
 | 
			
		||||
							<option value="256">256</option>
 | 
			
		||||
						</select> <small class="form-text text-muted">Higher values are
 | 
			
		||||
							stronger, but lower values have better compatibility.</small>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Permissions to set</label>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canAssembleDocument" name="canAssembleDocument"> <label
 | 
			
		||||
								class="form-check-label" for="canAssembleDocument">
 | 
			
		||||
								Prevent assembly of document </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canExtractContent" name="canExtractContent"> <label
 | 
			
		||||
								class="form-check-label" for="canExtractContent">
 | 
			
		||||
								Prevent content extraction </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canExtractForAccessibility"
 | 
			
		||||
								name="canExtractForAccessibility"> <label
 | 
			
		||||
								class="form-check-label" for="canExtractForAccessibility">
 | 
			
		||||
								Prevent extraction for accessibility </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canFillInForm" name="canFillInForm"> <label
 | 
			
		||||
								class="form-check-label" for="canFillInForm"> Prevent
 | 
			
		||||
								filling in form </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox" id="canModify"
 | 
			
		||||
								name="canModify"> <label class="form-check-label"
 | 
			
		||||
								for="canModify"> Prevent modification </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canModifyAnnotations" name="canModifyAnnotations"> <label
 | 
			
		||||
								class="form-check-label" for="canModifyAnnotations">
 | 
			
		||||
								Prevent annotation modification </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox" id="canPrint"
 | 
			
		||||
								name="canPrint"> <label class="form-check-label"
 | 
			
		||||
								for="canPrint"> Prevent printing </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canPrintFaithful" name="canPrintFaithful"> <label
 | 
			
		||||
								class="form-check-label" for="canPrintFaithful"> Prevent
 | 
			
		||||
								printing different formats </label>
 | 
			
		||||
						</div>
 | 
			
		||||
 | 
			
		||||
					</div>
 | 
			
		||||
					<br />
 | 
			
		||||
					<div class="form-group text-center">
 | 
			
		||||
						<button type="submit" class="btn btn-primary">Encrypt</button>
 | 
			
		||||
					</div>
 | 
			
		||||
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										56
									
								
								src/main/resources/templates/security/add-watermark.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								src/main/resources/templates/security/add-watermark.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,56 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Add Watermark')}"></th:block>
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Add Watermark</h2>
 | 
			
		||||
 | 
			
		||||
				<form method="post" enctype="multipart/form-data" action="add-watermark">
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
						<label>Select PDF to add watermark to:</label>
 | 
			
		||||
						<div class="custom-file">
 | 
			
		||||
							<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
								name="fileInput" required> <label
 | 
			
		||||
								class="custom-file-label">Choose PDF</label>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
		                <label for="watermarkText">Watermark Text:</label>
 | 
			
		||||
		                <input type="text" id="watermarkText" name="watermarkText" class="form-control" placeholder="Stirling-PDF" required/>
 | 
			
		||||
		            </div>
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
		                <label for="fontSize">Font Size:</label>
 | 
			
		||||
		                <input type="text" id="fontSize" name="fontSize" class="form-control" value="30"/>
 | 
			
		||||
		            </div>
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
		                <label for="rotation">Rotation (0-360):</label>
 | 
			
		||||
		                <input type="text" id="rotation" name="rotation" class="form-control"  value="45"/>
 | 
			
		||||
		            </div>
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
		                <label for="widthSpacer">widthSpacer (Space between each watermark horizontally):</label>
 | 
			
		||||
		                <input type="text" id="widthSpacer" name="widthSpacer" class="form-control" value="50"/>
 | 
			
		||||
		            </div>
 | 
			
		||||
		            <div class="form-group">
 | 
			
		||||
		                <label for="heightSpacer">heightSpacer (Space between each watermark vertically):</label>
 | 
			
		||||
		                <input type="text" id="heightSpacer" name="heightSpacer" class="form-control" value="50"/>
 | 
			
		||||
		            </div>
 | 
			
		||||
		            <div class="form-group text-center">
 | 
			
		||||
		                <input type="submit" value="Add Watermark" class="btn btn-primary"/>
 | 
			
		||||
		            </div>
 | 
			
		||||
        </form> 
 | 
			
		||||
</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@ -0,0 +1,93 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Change Permissions')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Change permissions</h2>
 | 
			
		||||
				<p>Warning to have these permissions be
 | 
			
		||||
					unchangeable it is recommended to set them with a password via the
 | 
			
		||||
					add-password page</p>
 | 
			
		||||
				<form action="add-password" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Select PDF to change permissions</label>
 | 
			
		||||
						<div class="custom-file">
 | 
			
		||||
							<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
								name="fileInput"> <label class="custom-file-label">Choose
 | 
			
		||||
								PDF</label>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Permissions to set</label>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canAssembleDocument" name="canAssembleDocument"> <label
 | 
			
		||||
								class="form-check-label" for="canAssembleDocument">
 | 
			
		||||
								Prevent assembly of document </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canExtractContent" name="canExtractContent"> <label
 | 
			
		||||
								class="form-check-label" for="canExtractContent">
 | 
			
		||||
								Prevent content extraction </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canExtractForAccessibility"
 | 
			
		||||
								name="canExtractForAccessibility"> <label
 | 
			
		||||
								class="form-check-label" for="canExtractForAccessibility">
 | 
			
		||||
								Prevent extraction for accessibility </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canFillInForm" name="canFillInForm"> <label
 | 
			
		||||
								class="form-check-label" for="canFillInForm"> Prevent
 | 
			
		||||
								filling in form </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox" id="canModify"
 | 
			
		||||
								name="canModify"> <label class="form-check-label"
 | 
			
		||||
								for="canModify"> Prevent modification </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canModifyAnnotations" name="canModifyAnnotations"> <label
 | 
			
		||||
								class="form-check-label" for="canModifyAnnotations">
 | 
			
		||||
								Prevent annotation modification </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox" id="canPrint"
 | 
			
		||||
								name="canPrint"> <label class="form-check-label"
 | 
			
		||||
								for="canPrint"> Prevent printing </label>
 | 
			
		||||
						</div>
 | 
			
		||||
						<div class="form-check">
 | 
			
		||||
							<input class="form-check-input" type="checkbox"
 | 
			
		||||
								id="canPrintFaithful" name="canPrintFaithful"> <label
 | 
			
		||||
								class="form-check-label" for="canPrintFaithful"> Prevent
 | 
			
		||||
								printing different formats </label>
 | 
			
		||||
						</div>
 | 
			
		||||
 | 
			
		||||
					</div>
 | 
			
		||||
					<br />
 | 
			
		||||
					<div class="form-group text-center">
 | 
			
		||||
						<button type="submit" class="btn btn-primary">Change</button>
 | 
			
		||||
					</div>
 | 
			
		||||
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
							
								
								
									
										38
									
								
								src/main/resources/templates/security/remove-password.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/main/resources/templates/security/remove-password.html
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Remove password')}"></th:block>
 | 
			
		||||
 | 
			
		||||
<body>	<div id="page-container">
 | 
			
		||||
		<div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
		<div class="row justify-content-center">
 | 
			
		||||
			<div class="col-md-6">
 | 
			
		||||
				<h2>Remove password (Decrypt)</h2>
 | 
			
		||||
 | 
			
		||||
				<form action="add-password" method="post"
 | 
			
		||||
					enctype="multipart/form-data">
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Select PDF to Decrypt</label>
 | 
			
		||||
						<div class="custom-file">
 | 
			
		||||
							<input type="file" class="custom-file-input" id="fileInput"
 | 
			
		||||
								name="fileInput" required> <label
 | 
			
		||||
								class="custom-file-label">Choose PDF</label>
 | 
			
		||||
						</div>
 | 
			
		||||
					</div>
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label>Password</label> <input type="password"
 | 
			
		||||
							class="form-control" id="password" name="password" required>
 | 
			
		||||
					</div>
 | 
			
		||||
				</form>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	</div>
 | 
			
		||||
		<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,12 +1,14 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en" xmlns:th="http://www.thymeleaf.org">
 | 
			
		||||
<head>
 | 
			
		||||
<th:block th:insert="~{common :: head}"></th:block>
 | 
			
		||||
<title>S-PDF Split PDFs</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<th:block th:insert="~{fragments/common :: head(title='Split')}"></th:block>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
	<div th:insert="~{navbar.html :: navbar}"></div>
 | 
			
		||||
 | 
			
		||||
 <div id="page-container">
 | 
			
		||||
   <div id="content-wrap">
 | 
			
		||||
	<div th:insert="~{fragments/navbar.html :: navbar}"></div>
 | 
			
		||||
	<br>
 | 
			
		||||
	<br>
 | 
			
		||||
	<div class="container">
 | 
			
		||||
@ -35,15 +37,17 @@
 | 
			
		||||
					<div class="form-group">
 | 
			
		||||
						<label for="pages">Enter pages to split on:</label> <input
 | 
			
		||||
							type="text" class="form-control" id="pages" name="pages"
 | 
			
		||||
							placeholder="1,3,5-10">
 | 
			
		||||
							placeholder="1,3,5-10" required>
 | 
			
		||||
					</div>
 | 
			
		||||
					<br>
 | 
			
		||||
					<button type="submit" class="btn btn-primary">Submit</button>
 | 
			
		||||
				</form>
 | 
			
		||||
				<th:block th:insert="~{common :: filelist}"></th:block>
 | 
			
		||||
				<th:block th:insert="~{fragments/common :: filelist}"></th:block>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div th:insert="~{fragments/footer.html :: footer}"></div>
 | 
			
		||||
	</div>
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user