Split pages support n function and other stuff

This commit is contained in:
Anthony Stirling
2023-06-03 22:56:15 +01:00
parent 4594765cbd
commit c526e18992
16 changed files with 2682 additions and 119 deletions

View File

@@ -54,14 +54,11 @@ home.pdfOrganiser.title=Organise
home.pdfOrganiser.desc=Remove/Rearrange pages in any order
home.addImage.title=Add image
home.addImage.desc=Adds a image onto a set location on the PDF (Work in progress)
home.addImage.desc=Adds a image onto a set location on the PDF
home.watermark.title=Add Watermark
home.watermark.desc=Add a custom watermark to your PDF document.
home.remove-watermark.title=Remove Watermark
home.remove-watermark.desc=Remove watermarks from your PDF document.
home.permissions.title=Change Permissions
home.permissions.desc=Change the permissions of your PDF document
@@ -131,8 +128,8 @@ home.certSign.desc=Signs a PDF with a Certificate/Key (PEM/P12)
home.pageLayout.title=Multi-Page Layout
home.pageLayout.desc=Merge multiple pages of a PDF document into a single page
home.scalePages.title=Adjust page-scale
home.scalePages.desc=Change the size of page contents while maintaining a set page-size
home.scalePages.title=Adjust page size/scale
home.scalePages.desc=Change the size/scale of page and/or its contents.
error.pdfPassword=The PDF Document is passworded and either the password was not provided or was incorrect

View File

@@ -14,7 +14,7 @@ $(document).ready(function() {
const files = $('#fileInput-input')[0].files;
const formData = new FormData(this);
const override = $('#override').val() || '';
const originalButtonText = $('#submitBtn').text();
$('#submitBtn').text('Processing...');
try {
@@ -24,10 +24,10 @@ $(document).ready(function() {
await handleSingleDownload(url, formData);
}
$('#submitBtn').text('Submit');
$('#submitBtn').text(originalButtonText);
} catch (error) {
handleDownloadError(error);
$('#submitBtn').text('Submit');
$('#submitBtn').text(originalButtonText);
console.error(error);
}
});
@@ -83,7 +83,7 @@ async function handleJsonResponse(response) {
const json = await response.json();
const errorMessage = JSON.stringify(json, null, 2);
if (errorMessage.toLowerCase().includes('the password is incorrect') || errorMessage.toLowerCase().includes('Password is not provided') || errorMessage.toLowerCase().includes('PDF contains an encryption dictionary')) {
alert('[[#{error.pdfPassword}]]');
alert(pdfPasswordPrompt);
} else {
showErrorBanner(json.error + ':' + json.message, json.trace);
}

View File

@@ -91,6 +91,9 @@
</th:block>
<th:block th:fragment="fileSelector(name, multiple)" th:with="accept=${accept} ?: '*/*', inputText=${inputText} ?: #{pdfPrompt}, remoteCall=${remoteCall} ?: 'true', notRequired=${notRequired} ?: false">
<script th:inline="javascript">
const pdfPasswordPrompt = /*[[#{error.pdfPassword}]]]*/ '';
</script>
<script src="js/downloader.js"></script>
<div class="custom-file-chooser">

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html th:lang="${#locale.toString()}" th:lang-direction="#{language.direction}" xmlns:th="http://www.thymeleaf.org">
<th:block th:insert="~{fragments/common :: head(title=#{autoCrop.title})}"></th:block>
<body>
<th:block th:insert="~{fragments/common :: game}"></th:block>
<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 th:text="#{autoCrop.header}"></h2>
<form method="post" enctype="multipart/form-data" th:action="@{auto-crop}">
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multiple=false, accept='application/pdf')}"></div>
<br>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{autoCrop.submit}"></button>
</form>
<p class="mt-3" th:text="#{autoCrop.credit}"></p>
</div>
</div>
</div>
</div>
<div th:insert="~{fragments/footer.html :: footer}"></div>
</div>
</body>
</html>