1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-23 15:21:25 +01:00

Merge remote-tracking branch 'origin/main' into bug/remember-me

This commit is contained in:
Anthony Stirling 2024-11-15 21:30:14 +00:00
commit c2062c19ab
47 changed files with 518 additions and 213 deletions

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=عرض PDF viewPdf.title=عرض PDF
viewPdf.header=عرض PDF viewPdf.header=عرض PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Преглед на PDF viewPdf.title=Преглед на PDF
viewPdf.header=Преглед на PDF viewPdf.header=Преглед на PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visualitza PDF viewPdf.title=Visualitza PDF
viewPdf.header=Visualitza PDF viewPdf.header=Visualitza PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Zobrazit PDF viewPdf.title=Zobrazit PDF
viewPdf.header=Zobrazit PDF viewPdf.header=Zobrazit PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Se PDF viewPdf.title=Se PDF
viewPdf.header=Se PDF viewPdf.header=Se PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Seite
multiTool.deleteSelected=Auswahl löschen multiTool.deleteSelected=Auswahl löschen
multiTool.downloadAll=Downloaden multiTool.downloadAll=Downloaden
multiTool.downloadSelected=Auswahl downloaden multiTool.downloadSelected=Auswahl downloaden
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDF anzeigen viewPdf.title=PDF anzeigen
viewPdf.header=PDF anzeigen viewPdf.header=PDF anzeigen

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Προβολή PDF viewPdf.title=Προβολή PDF
viewPdf.header=Προβολή PDF viewPdf.header=Προβολή PDF

View File

@ -81,6 +81,7 @@ page=Page
pages=Pages pages=Pages
loading=Loading... loading=Loading...
addToDoc=Add to Document addToDoc=Add to Document
reset=Reset
legal.privacy=Privacy Policy legal.privacy=Privacy Policy
legal.terms=Terms and Conditions legal.terms=Terms and Conditions
@ -942,6 +943,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=View PDF viewPdf.title=View PDF
viewPdf.header=View PDF viewPdf.header=View PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=View PDF viewPdf.title=View PDF
viewPdf.header=View PDF viewPdf.header=View PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Ver PDF viewPdf.title=Ver PDF
viewPdf.header=Ver PDF viewPdf.header=Ver PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=View PDF viewPdf.title=View PDF
viewPdf.header=View PDF viewPdf.header=View PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visualiser un PDF viewPdf.title=Visualiser un PDF
viewPdf.header=Visualiser un PDF viewPdf.header=Visualiser un PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Féach PDF viewPdf.title=Féach PDF
viewPdf.header=Féach PDF viewPdf.header=Féach PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=पीडीएफ देखें viewPdf.title=पीडीएफ देखें
viewPdf.header=पीडीएफ देखें viewPdf.header=पीडीएफ देखें

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Pogledaj viewPdf.title=Pogledaj
viewPdf.header=Pogledaj PDF viewPdf.header=Pogledaj PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDF megtekintése viewPdf.title=PDF megtekintése
viewPdf.header=PDF megtekintése viewPdf.header=PDF megtekintése

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Lihat PDF viewPdf.title=Lihat PDF
viewPdf.header=Lihat PDF viewPdf.header=Lihat PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Pagina
multiTool.deleteSelected=Elimina selezionata multiTool.deleteSelected=Elimina selezionata
multiTool.downloadAll=Esporta multiTool.downloadAll=Esporta
multiTool.downloadSelected=Esporta selezionata multiTool.downloadSelected=Esporta selezionata
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visualizza PDF viewPdf.title=Visualizza PDF
viewPdf.header=Visualizza PDF viewPdf.header=Visualizza PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDFを表示 viewPdf.title=PDFを表示
viewPdf.header=PDFを表示 viewPdf.header=PDFを表示

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDF 뷰어 viewPdf.title=PDF 뷰어
viewPdf.header=PDF 뷰어 viewPdf.header=PDF 뷰어

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDF bekijken viewPdf.title=PDF bekijken
viewPdf.header=PDF bekijken viewPdf.header=PDF bekijken

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Vis PDF viewPdf.title=Vis PDF
viewPdf.header=Vis PDF viewPdf.header=Vis PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Podejrzyj PDF viewPdf.title=Podejrzyj PDF
viewPdf.header=Podejrzyj PDF viewPdf.header=Podejrzyj PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visualizar PDF viewPdf.title=Visualizar PDF
viewPdf.header=Visualizar PDF viewPdf.header=Visualizar PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visualizar PDF viewPdf.title=Visualizar PDF
viewPdf.header=Visualizar PDF viewPdf.header=Visualizar PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Vizualizează PDF viewPdf.title=Vizualizează PDF
viewPdf.header=Vizualizează PDF viewPdf.header=Vizualizează PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Просмотреть PDF viewPdf.title=Просмотреть PDF
viewPdf.header=Просмотреть PDF viewPdf.header=Просмотреть PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Zobraziť PDF viewPdf.title=Zobraziť PDF
viewPdf.header=Zobraziť PDF viewPdf.header=Zobraziť PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Prikaz viewPdf.title=Prikaz
viewPdf.header=Prikaz PDF-a viewPdf.header=Prikaz PDF-a

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Visa PDF viewPdf.title=Visa PDF
viewPdf.header=Visa PDF viewPdf.header=Visa PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=ดู PDF viewPdf.title=ดู PDF
viewPdf.header=ดู PDF viewPdf.header=ดู PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=PDF Görüntüle viewPdf.title=PDF Görüntüle
viewPdf.header=PDF Görüntüle viewPdf.header=PDF Görüntüle

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Переглянути PDF viewPdf.title=Переглянути PDF
viewPdf.header=Переглянути PDF viewPdf.header=Переглянути PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=Xem PDF viewPdf.title=Xem PDF
viewPdf.header=Xem PDF viewPdf.header=Xem PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=浏览PDF viewPdf.title=浏览PDF
viewPdf.header=浏览PDF viewPdf.header=浏览PDF

View File

@ -942,6 +942,10 @@ multiTool.page=Page
multiTool.deleteSelected=Delete Selected multiTool.deleteSelected=Delete Selected
multiTool.downloadAll=Export multiTool.downloadAll=Export
multiTool.downloadSelected=Export Selected multiTool.downloadSelected=Export Selected
#multiTool-advert
multiTool-advert.message=This feature is also available in our <a href="{0}">multi-tool page</a>. Check it out for enhanced page-by-page UI and additional features!
#view pdf #view pdf
viewPdf.title=檢視 PDF viewPdf.title=檢視 PDF
viewPdf.header=檢視 PDF viewPdf.header=檢視 PDF

View File

@ -64,6 +64,8 @@
await handleSingleDownload(url, formData); await handleSingleDownload(url, formData);
} }
} }
clearFileInput();
clearTimeout(timeoutId); clearTimeout(timeoutId);
$("#submitBtn").text(originalButtonText); $("#submitBtn").text(originalButtonText);
@ -85,6 +87,7 @@
} }
} catch (error) { } catch (error) {
clearFileInput();
clearTimeout(timeoutId); clearTimeout(timeoutId);
handleDownloadError(error); handleDownloadError(error);
$("#submitBtn").text(originalButtonText); $("#submitBtn").text(originalButtonText);
@ -166,13 +169,19 @@
let filename = getFilenameFromContentDisposition(contentDisposition); let filename = getFilenameFromContentDisposition(contentDisposition);
const blob = await response.blob(); const blob = await response.blob();
const result = await handleResponse(blob, filename, !isMulti, isZip);
// Track successful processing
trackFileProcessing(file, startTime, true, null); trackFileProcessing(file, startTime, true, null);
return result; if (contentType.includes("application/pdf") || contentType.includes("image/")) {
clearFileInput();
return handleResponse(blob, filename, !isMulti, isZip);
} else {
clearFileInput();
return handleResponse(blob, filename, false, isZip);
}
} catch (error) { } catch (error) {
clearFileInput();
console.error("Error in handleSingleDownload:", error); console.error("Error in handleSingleDownload:", error);
trackFileProcessing(file, startTime, false, error.message); trackFileProcessing(file, startTime, false, error.message);
throw error; throw error;
@ -343,4 +352,27 @@ return { filename, blob, url };
} }
}); });
// Clear file input after job
function clearFileInput(){
let pathname = document.location.pathname;
if(pathname != "/merge-pdfs"){
let formElement = document.querySelector("#fileInput-input");
formElement.value = '';
let editSectionElement = document.querySelector("#editSection");
if(editSectionElement){
editSectionElement.style.display = "none";
}
let cropPdfCanvas = document.querySelector("#crop-pdf-canvas");
let overlayCanvas = document.querySelector("#overlayCanvas");
if(cropPdfCanvas && overlayCanvas){
cropPdfCanvas.width = 0;
cropPdfCanvas.heigth = 0;
overlayCanvas.width = 0;
overlayCanvas.heigth = 0;
}
} else{
console.log("Disabled for 'Merge'");
}
}
})(); })();

View File

@ -21,7 +21,7 @@ async function displayFiles(files) {
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
const pageCount = await getPDFPageCount(files[i]); const pageCount = await getPDFPageCount(files[i]);
const pageLabel = pageCount === 1 ? pageTranslation : pagesTranslation; const pageLabel = pageCount === 1 ? pageTranslation : pagesTranslation;
// Create list item // Create list item
const item = document.createElement("li"); const item = document.createElement("li");
item.className = "list-group-item"; item.className = "list-group-item";
@ -173,3 +173,18 @@ function updateFiles() {
} }
document.getElementById("fileInput-input").files = dataTransfer.files; document.getElementById("fileInput-input").files = dataTransfer.files;
} }
document.querySelector("#resetFileInputBtn").addEventListener("click", ()=>{
let formElement = document.querySelector("#fileInput-input");
formElement.value = '';
clearLiElements();
updateFiles();
});
function clearLiElements(){
let listGroupItemNodeList = document.querySelectorAll(".list-group-item");
for (let i = 0; i < listGroupItemNodeList.length; i++) {
listGroupItemNodeList[i].remove();
};
}

View File

@ -28,6 +28,7 @@ class PdfContainer {
this.toggleSelectPageVisibility = this.toggleSelectPageVisibility.bind(this); this.toggleSelectPageVisibility = this.toggleSelectPageVisibility.bind(this);
this.updatePagesFromCSV = this.updatePagesFromCSV.bind(this); this.updatePagesFromCSV = this.updatePagesFromCSV.bind(this);
this.addFilesBlankAll = this.addFilesBlankAll.bind(this) this.addFilesBlankAll = this.addFilesBlankAll.bind(this)
this.removeAllElements = this.removeAllElements.bind(this);
this.pdfAdapters = pdfAdapters; this.pdfAdapters = pdfAdapters;
@ -53,6 +54,7 @@ class PdfContainer {
window.updateSelectedPagesDisplay = this.updateSelectedPagesDisplay; window.updateSelectedPagesDisplay = this.updateSelectedPagesDisplay;
window.updatePageNumbersAndCheckboxes = this.updatePageNumbersAndCheckboxes; window.updatePageNumbersAndCheckboxes = this.updatePageNumbersAndCheckboxes;
window.addFilesBlankAll = this.addFilesBlankAll window.addFilesBlankAll = this.addFilesBlankAll
window.removeAllElements = this.removeAllElements;
const filenameInput = document.getElementById("filename-input"); const filenameInput = document.getElementById("filename-input");
const downloadBtn = document.getElementById("export-button"); const downloadBtn = document.getElementById("export-button");
@ -294,6 +296,16 @@ class PdfContainer {
} }
} }
removeAllElements(){
let pageContainerNodeList = document.querySelectorAll(".page-container");
for (var i = 0; i < pageContainerNodeList.length; i++) {
pageContainerNodeList[i].remove();
}
document.querySelectorAll(".enable-on-file").forEach((element) => {
element.disabled = true;
});
}
deleteSelected() { deleteSelected() {
window.selectedPages.sort((a, b) => a - b); window.selectedPages.sort((a, b) => a - b);
let deletions = 0; let deletions = 0;

View File

@ -1,36 +1,44 @@
<!DOCTYPE html> <!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> <html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}"
<head> xmlns:th="https://www.thymeleaf.org">
<th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}"></th:block>
</head>
<body> <head>
<div id="page-container"> <th:block th:insert="~{fragments/common :: head(title=#{pageExtracter.title}, header=#{pageExtracter.header})}">
<div id="content-wrap"> </th:block>
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> </head>
<br><br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">upload</span>
<span class="tool-header-text" th:text="#{pageExtracter.header}"></span>
</div>
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data">
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div>
<input type="hidden" id="customMode" name="customMode" value="">
<div class="mb-3">
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label>
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" th:placeholder="#{pageExtracter.placeholder}" required>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageExtracter.submit}"></button> <body>
</form> <div id="page-container">
<div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<br><br>
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">upload</span>
<span class="tool-header-text" th:text="#{pageExtracter.header}"></span>
</div> </div>
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data">
<div
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}">
</div>
<input type="hidden" id="customMode" name="customMode" value="">
<div class="mb-3">
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label>
<input type="text" class="form-control" id="pageOrder" name="pageNumbers"
th:placeholder="#{pageExtracter.placeholder}" required>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageExtracter.submit}"></button>
</form>
</div> </div>
</div> </div>
</div> </div>
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div> </div>
</body> <th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div>
</body>
</html> </html>

View File

@ -0,0 +1,57 @@
<div th:fragment="multi-toolAdvert" class="mx-auto">
<div id="multi-toolAdvert" class="multi-toolAdvert">
<div>
<span th:utext="#{multiTool-advert.message(|/multi-tool|)}"></span>
<button id="closeMultiToolAdvert" style="position: absolute;
top: 10px;
right: 12px;
border: none;
background: transparent;
color: white;
cursor: pointer;
font-size: 1.2rem;
line-height: 1;" aria-label="Close">&times;</button>
</div>
</div>
<style>
.multi-toolAdvert {
margin-bottom: 10px;
margin-left: 50%;
transform: translateX(-50%);
max-width: 52rem;
z-index: 0;
background-color: var(--md-sys-color-surface-5);
border-radius: 2rem;
padding: 10px 27px 10px 20px;
font-size: 0.9rem;
display: none;
justify-content: center;
}
.multi-toolAdvert a {
color: #007bff;
font-weight: bold;
}
.multi-toolAdvert a:hover {
text-decoration: underline;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', () => {
const advert = document.getElementById('multi-toolAdvert');
const closeBtn = document.getElementById('closeMultiToolAdvert');
const cacheKey = `closeMultiToolAdvert_${window.location.pathname}`;
if (localStorage.getItem(cacheKey) !== 'true') {
advert.style.display = 'flex';
}
closeBtn.addEventListener('click', () => {
advert.style.display = 'none';
localStorage.setItem(cacheKey, 'true');
});
});
</script>
</div>

View File

@ -12,6 +12,7 @@
<div id="content-wrap"> <div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<br><br> <br><br>
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<div class="container" id="dropContainer"> <div class="container" id="dropContainer">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 bg-card"> <div class="col-md-6 bg-card">
@ -39,6 +40,9 @@
<button type="button" id="sortByDateBtn" class="btn btn-info" th:text="#{merge.sortByDate}"></button> <button type="button" id="sortByDateBtn" class="btn btn-info" th:text="#{merge.sortByDate}"></button>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{merge.submit}"></button> <button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{merge.submit}"></button>
</div> </div>
<div class="mb-3">
<button type="button" id="resetFileInputBtn" class="btn btn-danger" th:text="#{reset}">Reset</button>
</div>
</form> </form>
<span id="pageTranslation" th:text="#{page}" style="display:none;"></span> <span id="pageTranslation" th:text="#{page}" style="display:none;"></span>
<span id="pagesTranslation" th:text="#{pages}" style="display:none;"></span> <span id="pagesTranslation" th:text="#{pages}" style="display:none;"></span>

View File

@ -83,6 +83,9 @@
</span> </span>
</button> </button>
</div> </div>
<div class="mb-3">
<button type="button" id="resetFileInputBtn" class="btn btn-danger" onclick="removeAllElements()" th:text="#{reset}">Reset</button>
</div>
<div id="selected-pages-display" class="selected-pages-container hidden"> <div id="selected-pages-display" class="selected-pages-container hidden">
<div style="display:flex; height:3rem; margin-right:1rem"> <div style="display:flex; height:3rem; margin-right:1rem">
<h5 th:text="#{multiTool.selectedPages}" style="white-space: nowrap; margin-right: 1rem;">Selected <h5 th:text="#{multiTool.selectedPages}" style="white-space: nowrap; margin-right: 1rem;">Selected

View File

@ -1,60 +1,69 @@
<!DOCTYPE html> <!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> <html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}"
<head> xmlns:th="https://www.thymeleaf.org">
<th:block th:insert="~{fragments/common :: head(title=#{pdfOrganiser.title}, header=#{pdfOrganiser.header})}"></th:block>
</head>
<body> <head>
<div id="page-container"> <th:block th:insert="~{fragments/common :: head(title=#{pdfOrganiser.title}, header=#{pdfOrganiser.header})}">
<div id="content-wrap"> </th:block>
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> </head>
<br><br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">format_list_bulleted</span>
<span class="tool-header-text" th:text="#{pdfOrganiser.header}"></span>
</div>
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data"> <body>
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div> <div id="page-container">
<div class="mb-3"> <div id="content-wrap">
<label for="customMode" th:text="#{pdfOrganiser.mode}">Mode</label> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<select class="form-control" id="customMode" name="customMode"> <br><br>
<option value="" th:text="#{pdfOrganiser.mode.1}">Custom Page Order</option> <th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<option value="REVERSE_ORDER" th:text="#{pdfOrganiser.mode.2}">Reverse Order</option> <div class="container">
<option value="DUPLEX_SORT" th:text="#{pdfOrganiser.mode.3}">Duplex Sort</option> <div class="row justify-content-center">
<option value="BOOKLET_SORT" th:text="#{pdfOrganiser.mode.4}">Booklet Sort</option> <div class="col-md-6 bg-card">
<option value="SIDE_STITCH_BOOKLET_SORT" th:text="#{pdfOrganiser.mode.5}">Side Stitch Booklet Sort</option> <div class="tool-header">
<option value="ODD_EVEN_SPLIT" th:text="#{pdfOrganiser.mode.6}">Odd-Even Split</option> <span class="material-symbols-rounded tool-header-icon organize">format_list_bulleted</span>
<option value="ODD_EVEN_MERGE" th:text="#{pdfOrganiser.mode.10}">Odd-Even Merge</option> <span class="tool-header-text" th:text="#{pdfOrganiser.header}"></span>
<option value="REMOVE_FIRST" th:text="#{pdfOrganiser.mode.7}">Remove First</option>
<option value="REMOVE_LAST" th:text="#{pdfOrganiser.mode.8}">Remove Last</option>
<option value="REMOVE_FIRST_AND_LAST" th:text="#{pdfOrganiser.mode.9}">Remove First and Last</option>
</select>
</div>
<div class="mb-3">
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label>
<input type="text" class="form-control" id="pageOrder" name="pageNumbers" th:placeholder="#{pdfOrganiser.placeholder}" required>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfOrganiser.submit}"></button>
</form>
<script>
document.getElementById('customMode').addEventListener('change', function () {
var pageOrderInput = document.getElementById('pageOrder');
if (this.value === "") {
pageOrderInput.disabled = false;
} else {
pageOrderInput.disabled = true;
}
});
</script>
</div> </div>
<form th:action="@{'/api/v1/general/rearrange-pages'}" method="post" enctype="multipart/form-data">
<div
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}">
</div>
<div class="mb-3">
<label for="customMode" th:text="#{pdfOrganiser.mode}">Mode</label>
<select class="form-control" id="customMode" name="customMode">
<option value="" th:text="#{pdfOrganiser.mode.1}">Custom Page Order</option>
<option value="REVERSE_ORDER" th:text="#{pdfOrganiser.mode.2}">Reverse Order</option>
<option value="DUPLEX_SORT" th:text="#{pdfOrganiser.mode.3}">Duplex Sort</option>
<option value="BOOKLET_SORT" th:text="#{pdfOrganiser.mode.4}">Booklet Sort</option>
<option value="SIDE_STITCH_BOOKLET_SORT" th:text="#{pdfOrganiser.mode.5}">Side Stitch Booklet Sort
</option>
<option value="ODD_EVEN_SPLIT" th:text="#{pdfOrganiser.mode.6}">Odd-Even Split</option>
<option value="ODD_EVEN_MERGE" th:text="#{pdfOrganiser.mode.10}">Odd-Even Merge</option>
<option value="REMOVE_FIRST" th:text="#{pdfOrganiser.mode.7}">Remove First</option>
<option value="REMOVE_LAST" th:text="#{pdfOrganiser.mode.8}">Remove Last</option>
<option value="REMOVE_FIRST_AND_LAST" th:text="#{pdfOrganiser.mode.9}">Remove First and Last</option>
</select>
</div>
<div class="mb-3">
<label for="pageOrder" th:text="#{pageOrderPrompt}"></label>
<input type="text" class="form-control" id="pageOrder" name="pageNumbers"
th:placeholder="#{pdfOrganiser.placeholder}" required>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pdfOrganiser.submit}"></button>
</form>
<script>
document.getElementById('customMode').addEventListener('change', function () {
var pageOrderInput = document.getElementById('pageOrder');
if (this.value === "") {
pageOrderInput.disabled = false;
} else {
pageOrderInput.disabled = true;
}
});
</script>
</div> </div>
</div> </div>
</div> </div>
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div> </div>
</body> <th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div>
</body>
</html> </html>

View File

@ -1,40 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> <html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}"
<head> xmlns:th="https://www.thymeleaf.org">
<th:block th:insert="~{fragments/common :: head(title=#{pageRemover.title}, header=#{pageRemover.header})}"></th:block>
</head>
<body> <head>
<div id="page-container"> <th:block th:insert="~{fragments/common :: head(title=#{pageRemover.title}, header=#{pageRemover.header})}">
<div id="content-wrap"> </th:block>
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> </head>
<br><br>
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">delete</span>
<span class="tool-header-text" th:text="#{pageRemover.header}"></span>
</div>
<form th:action="@{'/api/v1/general/remove-pages'}" method="post" enctype="multipart/form-data"> <body>
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div> <div id="page-container">
<div class="mb-3"> <div id="content-wrap">
<label for="fileInput" th:text="#{pageRemover.pagesToDelete}"></label> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<input type="text" class="form-control" id="fileInput" name="pageNumbers" th:placeholder="#{pageRemover.placeholder}" required> <br><br>
</div> <th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageRemover.submit}"></button> <div class="container">
</form> <div class="row justify-content-center">
<div class="col-md-6 bg-card">
<div class="tool-header">
<span class="material-symbols-rounded tool-header-icon organize">delete</span>
<span class="tool-header-text" th:text="#{pageRemover.header}"></span>
</div> </div>
<form th:action="@{'/api/v1/general/remove-pages'}" method="post" enctype="multipart/form-data">
<div
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}">
</div>
<div class="mb-3">
<label for="fileInput" th:text="#{pageRemover.pagesToDelete}"></label>
<input type="text" class="form-control" id="fileInput" name="pageNumbers"
th:placeholder="#{pageRemover.placeholder}" required>
</div>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{pageRemover.submit}"></button>
</form>
</div> </div>
</div> </div>
</div> </div>
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div> </div>
<script> <th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
document.getElementById('fileInput').addEventListener('input', function(){ </div>
this.value =this.value.replace(/\s+/g, '');; <script>
}); document.getElementById('fileInput').addEventListener('input', function () {
</script> this.value = this.value.replace(/\s+/g, '');;
</body> });
</html> </script>
</body>
</html>

View File

@ -1,110 +1,121 @@
<!DOCTYPE html> <!DOCTYPE html>
<html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}" xmlns:th="https://www.thymeleaf.org"> <html th:lang="${#locale.language}" th:dir="#{language.direction}" th:data-language="${#locale.toString()}"
<head> xmlns:th="https://www.thymeleaf.org">
<head>
<th:block th:insert="~{fragments/common :: head(title=#{rotate.title}, header=#{rotate.header})}"></th:block> <th:block th:insert="~{fragments/common :: head(title=#{rotate.title}, header=#{rotate.header})}"></th:block>
</head> </head>
<body> <body>
<div id="page-container"> <div id="page-container">
<div id="content-wrap"> <div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<br><br> <br><br>
<div class="container"> <th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<div class="row justify-content-center"> <div class="container">
<div class="col-md-6 bg-card"> <div class="row justify-content-center">
<div class="tool-header"> <div class="col-md-6 bg-card">
<span class="material-symbols-rounded tool-header-icon organize">rotate_right</span> <div class="tool-header">
<span class="tool-header-text" th:text="#{rotate.header}"></span> <span class="material-symbols-rounded tool-header-icon organize">rotate_right</span>
</div> <span class="tool-header-text" th:text="#{rotate.header}"></span>
<form action="#" th:action="@{'/api/v1/general/rotate-pdf'}" th:object="${rotateForm}" method="post" enctype="multipart/form-data">
<div th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}"></div>
<input type="hidden" id="angleInput" name="angle" value="0">
<div id="editSection" style="display: none">
<div id="previewContainer">
<!-- pdf-preview -->
</div>
<div class="buttonContainer">
<button type="button" class="btn btn-secondary" onclick="rotate(-90)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z" />
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z" />
</svg>
</button>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{rotate.submit}"></button>
<button type="button" class="btn btn-secondary" onclick="rotate(90)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
<path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
</svg>
</button>
</div>
</div>
</form>
</div> </div>
<form action="#" th:action="@{'/api/v1/general/rotate-pdf'}" th:object="${rotateForm}" method="post"
enctype="multipart/form-data">
<div
th:replace="~{fragments/common :: fileSelector(name='fileInput', multipleInputsForSingleRequest=false, accept='application/pdf')}">
</div>
<input type="hidden" id="angleInput" name="angle" value="0">
<div id="editSection" style="display: none">
<div id="previewContainer">
<!-- pdf-preview -->
</div>
<div class="buttonContainer">
<button type="button" class="btn btn-secondary" onclick="rotate(-90)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z" />
<path
d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z" />
</svg>
</button>
<button type="submit" id="submitBtn" class="btn btn-primary" th:text="#{rotate.submit}"></button>
<button type="button" class="btn btn-secondary" onclick="rotate(90)">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor"
class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2v1z" />
<path
d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466z" />
</svg>
</button>
</div>
</div>
</form>
</div> </div>
</div> </div>
</div> </div>
<th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
</div> </div>
<script type="module" th:src="@{'/pdfjs-legacy/pdf.mjs'}"></script> <th:block th:insert="~{fragments/footer.html :: footer}"></th:block>
<script> </div>
const angleInput = document.getElementById("angleInput"); <script type="module" th:src="@{'/pdfjs-legacy/pdf.mjs'}"></script>
const fileInput = document.getElementById("fileInput-input"); <script>
const previewContainer = document.getElementById("previewContainer"); const angleInput = document.getElementById("angleInput");
// const preview = document.getElementById("pdf-preview"); const fileInput = document.getElementById("fileInput-input");
fileInput.addEventListener("change", async function() { const previewContainer = document.getElementById("previewContainer");
console.log("loading pdf"); // const preview = document.getElementById("pdf-preview");
fileInput.addEventListener("change", async function () {
console.log("loading pdf");
document.querySelector("#editSection").style.display = ""; document.querySelector("#editSection").style.display = "block";
const existingPreview = document.getElementById("pdf-preview"); const existingPreview = document.getElementById("pdf-preview");
if (existingPreview) { if (existingPreview) {
existingPreview.remove(); existingPreview.remove();
}
var url = URL.createObjectURL(fileInput.files[0])
pdfjsLib.GlobalWorkerOptions.workerSrc = './pdfjs-legacy/pdf.worker.mjs'
const pdf = await pdfjsLib.getDocument(url).promise;
const page = await pdf.getPage(1);
const canvas = document.createElement("canvas");
// set the canvas size to the size of the page
if (page.rotate == 90 || page.rotate == 270) {
canvas.width = page.view[3];
canvas.height = page.view[2];
} else {
canvas.width = page.view[2];
canvas.height = page.view[3];
}
// render the page onto the canvas
var renderContext = {
canvasContext: canvas.getContext("2d"),
viewport: page.getViewport({ scale: 1 })
};
await page.render(renderContext).promise;
const preview = document.createElement("img");
preview.id = "pdf-preview";
preview.alt = "preview";
preview.src = canvas.toDataURL();
previewContainer.appendChild(preview);
});
function rotate(deg) {
const preview = document.getElementById("pdf-preview");
var lastTransform = preview.style.rotate;
if (!lastTransform) {
lastTransform = "0";
}
const lastAngle = parseInt(lastTransform.replace(/[^\d-]/g, ''));
const newAngle = lastAngle + deg;
preview.style.rotate = newAngle + "deg";
angleInput.value = newAngle;
} }
</script> var url = URL.createObjectURL(fileInput.files[0])
</body> pdfjsLib.GlobalWorkerOptions.workerSrc = './pdfjs-legacy/pdf.worker.mjs'
const pdf = await pdfjsLib.getDocument(url).promise;
const page = await pdf.getPage(1);
const canvas = document.createElement("canvas");
// set the canvas size to the size of the page
if (page.rotate == 90 || page.rotate == 270) {
canvas.width = page.view[3];
canvas.height = page.view[2];
} else {
canvas.width = page.view[2];
canvas.height = page.view[3];
}
// render the page onto the canvas
var renderContext = {
canvasContext: canvas.getContext("2d"),
viewport: page.getViewport({ scale: 1 })
};
await page.render(renderContext).promise;
const preview = document.createElement("img");
preview.id = "pdf-preview";
preview.alt = "preview";
preview.src = canvas.toDataURL();
previewContainer.appendChild(preview);
});
function rotate(deg) {
const preview = document.getElementById("pdf-preview");
var lastTransform = preview.style.rotate;
if (!lastTransform) {
lastTransform = "0";
}
const lastAngle = parseInt(lastTransform.replace(/[^\d-]/g, ''));
const newAngle = lastAngle + deg;
preview.style.rotate = newAngle + "deg";
angleInput.value = newAngle;
}
</script>
</body>
</html> </html>

View File

@ -11,6 +11,7 @@
<div id="content-wrap"> <div id="content-wrap">
<th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block> <th:block th:insert="~{fragments/navbar.html :: navbar}"></th:block>
<br><br> <br><br>
<th:block th:insert="~{fragments/multi-toolAdvert.html :: multi-toolAdvert}"></th:block>
<div class="container"> <div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div class="col-md-6 bg-card"> <div class="col-md-6 bg-card">