mirror of
https://github.com/24eme/signaturepdf
synced 2026-03-14 13:55:44 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
298e5afc14
1 changed files with 13 additions and 4 deletions
|
|
@ -77,6 +77,8 @@ async function loadPDF(pdfBlob, filename, pdfIndex) {
|
|||
|
||||
document.getElementById('container-pages').insertAdjacentHTML('beforeend', pageHTML);
|
||||
|
||||
document.querySelector('#input_rotate_'+pageIndex).value = page.rotate;
|
||||
|
||||
let canvasContainer = document.getElementById('canvas-container-' + pageIndex);
|
||||
canvasContainer.title = pageTitle;
|
||||
canvasContainer.addEventListener('click', function(e) {
|
||||
|
|
@ -293,7 +295,7 @@ function updateListePDF() {
|
|||
for (var i = 0; i < nbFiles; i++) {
|
||||
let pdfLetter = getLetter(i);
|
||||
const pdfFile = document.querySelector('#input_pdf').files.item(i);
|
||||
document.querySelector('#list_pdf').insertAdjacentHTML('beforeend', '<li id="file_' + pdfLetter + '" class="list-group-item small ps-2 pe-5" title="'+decodeURI(pdfFile.name)+'" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;"><i class="bi bi-files"></i><span class="ms-2">'+decodeURI(pdfFile.name)+'</span> <input class="form-check-input float-end position-absolute file-list-checkbox" type="checkbox" /> </li>');
|
||||
document.querySelector('#list_pdf').insertAdjacentHTML('beforeend', '<li id="file_' + pdfLetter + '" class="list-group-item small ps-2 pe-5" title="'+decodeURI(pdfFile.name)+'" style="text-overflow: ellipsis; white-space: nowrap; overflow: hidden;"><i class="bi bi-files"></i><label class="ms-2" style="cursor: pointer; display: inline;" for="file_' + pdfLetter + '_name">'+decodeURI(pdfFile.name)+'</label> <input id="file_' + pdfLetter + '_name" class="form-check-input float-end position-absolute file-list-checkbox" type="checkbox" /> </li>');
|
||||
let fileItem = document.querySelector('#file_' + pdfLetter);
|
||||
fileItem.querySelector('input[type=checkbox]').addEventListener('change', function(e) {
|
||||
document.querySelectorAll('.canvas-container').forEach(function(page) {
|
||||
|
|
@ -499,9 +501,9 @@ function updateFilesState() {
|
|||
let fileStat = filesStats[fileIndex];
|
||||
checkbox.checked = (fileStat.nbPageSelected > 0 && fileStat.nbPageSelected == fileStat.nbPage);
|
||||
checkbox.indeterminate = (fileStat.nbPageSelected > 0 && fileStat.nbPageSelected < fileStat.nbPage);
|
||||
document.querySelector('#file_'+fileIndex+' span').classList.remove('text-primary');
|
||||
document.querySelector('#file_'+fileIndex+' label').classList.remove('text-primary');
|
||||
if(fileStat.nbPageSelected > 0) {
|
||||
document.querySelector('#file_'+fileIndex+' span').classList.add('text-primary');
|
||||
document.querySelector('#file_'+fileIndex+' label').classList.add('text-primary');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -641,7 +643,14 @@ async function save(order) {
|
|||
pdfPage.setRotation(window['PDFLib'].degrees(parseInt(rotation)));
|
||||
}
|
||||
if(format) {
|
||||
resizePage(pdfPage, mm2points(parseInt(format.split("x")[0])), mm2points(parseInt(format.split("x")[1])));
|
||||
let width = mm2points(parseInt(format.split("x")[0]));
|
||||
let height = mm2points(parseInt(format.split("x")[1]));
|
||||
|
||||
if(pdfPage.getHeight() > pdfPage.getWidth()) {
|
||||
resizePage(pdfPage, Math.min(height, width), Math.max(height, width));
|
||||
} else {
|
||||
resizePage(pdfPage, Math.max(height, width), Math.min(height, width));
|
||||
}
|
||||
}
|
||||
pdf.addPage(pdfPage);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue