1
0
Fork 0
mirror of https://github.com/24eme/signaturepdf synced 2026-03-14 13:55:44 +01:00

Merge branch 'master' of github.com:24eme/signaturepdf

This commit is contained in:
Gabriel Poma 2025-09-25 12:54:27 +02:00
commit 7d441de2b5
50 changed files with 879 additions and 244 deletions

50
app.php
View file

@ -442,16 +442,23 @@ $f3->route('GET /compress',
$f3->route ('POST /compress',
function($f3) {
$filename = null;
$tmpfile = tempnam($f3->get('UPLOADS'), 'pdfsignature_compress_'.uniqid("", true));
unlink($tmpfile);
$originalFilename = null;
$files = Web::instance()->receive(function($file,$formFieldName) {
if ($formFieldName == "pdf" && strpos(Web::instance()->mime($file['tmp_name'], true), 'application/pdf') !== 0) {
$f3->error(403);
}
}, false, function($fileBaseName, $formFieldName) use(&$originalFilename) {
$originalFilename = $fileBaseName;
return date("YmdHis")."_".uniqid()."_".md5($fileBaseName).'.pdf';
});
if(!count($files)) {
http_response_code("500");
header('Content-Type: text/plain');
echo _("PDF compression failed");
return;
}
$compressionType = $f3->get('POST.compressionType');
if ($compressionType === 'medium') {
$compressionType = '/ebook';
@ -466,19 +473,19 @@ $f3->route ('POST /compress',
$returnCode = shell_exec(sprintf("gs -sDEVICE=pdfwrite -dPDFSETTINGS=%s -dPassThroughJPEGImages=false -dPassThroughJPXImages=false -dAutoFilterGrayImages=false -dAutoFilterColorImages=false -dDetectDuplicateImages=true -dQUIET -dBATCH -o %s %s", $compressionType, $outputFileName, $filePath));
if ($returnCode === false) {
if ($returnCode === false || !file_exists($outputFileName)) {
http_response_code("500");
header('Content-Type: text/plain');
echo _("PDF compression failed");
return;
} elseif (filesize($filePath) <= filesize($outputFileName)) {
http_response_code("500");
header('Content-Type: text/plain');
echo _("Your pdf is already optimized");
http_response_code("204");
unlink($outputFileName);
unlink($filePath);
return;
} else {
header('Content-Type: application/pdf');
header("Content-Disposition: attachment; filename=".basename($outputFileName));
header("Content-Disposition: attachment; filename=".basename(str_replace(".pdf", "_compressed.pdf", $originalFilename)));
readfile($outputFileName);
}
@ -494,13 +501,27 @@ $f3->route('GET /api/file/get', function($f3) {
}
$pdf_path = $localRootFolder . '/' . $f3->get('GET.path');
$pdf_filename = basename($pdf_path);
if (!preg_match('/.pdf$/', $pdf_path)) {
$extension = 'pdf';
if (preg_match('/.(pdf|png|jpg|jpeg)$/', $pdf_path, $m)) {
$extension = $m[1];
}else{
$f3->error(403);
}
if (!file_exists($pdf_path)) {
$f3->error(403);
}
header('Content-type: application/pdf');
switch ($extension) {
case 'jpg':
case 'jpeg':
header('Content-type: image/jpg');
break;
case 'png':
header('Content-type: image/png');
break;
default:
header('Content-type: application/pdf');
break;
}
header("Content-Disposition: attachment; filename=$pdf_filename");
echo file_get_contents($pdf_path);
});
@ -512,13 +533,16 @@ $f3->route('PUT /api/file/save', function($f3) {
}
$pdf_path = $localRootFolder . '/' . $f3->get('GET.path');
$pdf_filename = basename($pdf_path);
if (!preg_match('/.pdf$/', $pdf_path)) {
if (preg_match('/(.*).(pdf|png|jpg|jpeg)$/', $pdf_path, $m)) {
$basefile = $m[1];
$extension = $m[2];
}else{
$f3->error(403);
}
if (!file_exists($pdf_path)) {
$f3->error(403);
}
file_put_contents($pdf_path, $f3->get('BODY'));
file_put_contents($basefile.'.pdf', $f3->get('BODY'));
});

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-09-01 10:50+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -128,6 +128,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -152,6 +155,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -253,6 +259,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "No"
msgstr ""
@ -266,9 +275,6 @@ msgstr ""
msgid "%s Turn"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "PDF documents"
msgstr ""
@ -284,9 +290,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr ""

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2023-11-18 05:03+0000\n"
"Last-Translator: ButterflyOfFire <boffire@users.noreply.hosted.weblate.org>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/signature-pdf/"
@ -131,6 +131,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -155,6 +158,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -256,6 +262,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s تنزيل الـ PDF كاملًا"
msgid "Download the selection"
msgstr "تنزيل المُحدَّدة"
msgid "No"
msgstr "لا شيء"
@ -269,9 +278,6 @@ msgstr "إلغاء"
msgid "%s Turn"
msgstr "%s دوران"
msgid "Download the selection"
msgstr "تنزيل المُحدَّدة"
msgid "PDF documents"
msgstr "مستندات PDF"
@ -287,9 +293,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "وقِّع أو وقِّع جانبيا أو ضع خاتما أو اكمل مُستَنَدًا"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@ -127,6 +127,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -151,6 +154,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -252,6 +258,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "No"
msgstr ""
@ -265,9 +274,6 @@ msgstr ""
msgid "%s Turn"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "PDF documents"
msgstr ""
@ -283,9 +289,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr ""

Binary file not shown.

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2025-06-08 19:07+0000\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-07-11 04:03+0000\n"
"Last-Translator: Ettore Atalan <atalanttore@googlemail.com>\n"
"Language-Team: German <https://hosted.weblate.org/projects/signature-pdf/"
"application/de/>\n"
@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.12-dev\n"
"X-Generator: Weblate 5.13-dev\n"
msgid "en"
msgstr "de"
@ -132,6 +132,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -156,6 +159,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -258,6 +264,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s Vollständiges PDF herunterladen"
msgid "Download the selection"
msgstr "Auswahl herunterladen"
msgid "No"
msgstr "Nein"
@ -271,9 +280,6 @@ msgstr "Abbrechen"
msgid "%s Turn"
msgstr "%s Drehen"
msgid "Download the selection"
msgstr "Auswahl herunterladen"
msgid "PDF documents"
msgstr "PDF-Dokumente"
@ -287,9 +293,30 @@ msgid "Most common formats"
msgstr ""
msgid "Other formats"
msgstr "Andere Formate"
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr "Papiergröße"
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"

Binary file not shown.

View file

@ -7,9 +7,9 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2024-10-22 18:15+0000\n"
"Last-Translator: gallegonovato <fran-carro@hotmail.es>\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-08-27 20:01+0000\n"
"Last-Translator: Deleted User <noreply+48943@weblate.org>\n"
"Language-Team: Spanish <https://hosted.weblate.org/projects/signature-pdf/"
"application/es/>\n"
"Language: es\n"
@ -17,13 +17,13 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 5.8.2-dev\n"
"X-Generator: Weblate 5.13\n"
msgid "en"
msgstr "es"
msgid "PDF compression failed"
msgstr ""
msgstr "La compresión del PDF ha fallado"
msgid "Your pdf is already optimized"
msgstr "Tu pdf ya está optimizado"
@ -71,7 +71,7 @@ msgstr "Elige un PDF"
#, php-format
msgid "The PDF must not exceed %s Mb"
msgstr ""
msgstr "El PDF no puede exceder los %s Mb"
msgid ""
"The PDF will be processed by the server without being retained or stored"
@ -92,79 +92,85 @@ msgstr "Alta compresión (menor calidad)"
#, php-format
msgid "%s Mb"
msgstr ""
msgstr "%s Mb"
msgid "Compressed at %s%"
msgstr ""
msgstr "Comprimido al %s%"
msgid "Download the PDF"
msgstr "Descargar el PDF"
msgid "Free open-source software for signing and manipulating PDFs"
msgstr ""
msgstr "Software libre de código abierto para firma y manejo de archivos PDF"
msgid "Sign a PDF"
msgstr "Firmar un PDF"
msgid "Add a signature"
msgstr ""
msgstr "Agregar una firma"
msgid "Add initials"
msgstr ""
msgstr "Agregar iniciales"
msgid "Add a stamp"
msgstr ""
msgstr "Agregar un timbre"
msgid "Type text"
msgstr ""
msgstr "Escribir texto"
msgid "Strike through text"
msgstr ""
msgstr "Tachar texto"
msgid "Allow multiple people to sign via a shared link"
msgstr ""
msgstr "Permitir a varias personas firmar a través de un enlace compartido"
msgid "Sign with the server certificate"
msgstr ""
msgstr "Firmar utilizando el certificado de este servidor"
msgid "Add a watermark"
msgstr ""
msgstr "Agregar una marca da agua"
msgid "New"
msgstr "Nuevo"
msgid "Redact areas"
msgstr ""
msgstr "Ocultar áreas"
msgid "Organize PDFs"
msgstr ""
msgstr "Organizar PDFs"
msgid "Combine multiple PDF files"
msgstr ""
msgstr "Combinar múltiples archivos PDF"
msgid "Reorder pages"
msgstr ""
msgstr "Reordenar páginas"
msgid "Extract pages"
msgstr ""
msgstr "Extraer páginas"
msgid "Rotate pages"
msgstr ""
msgstr "Rotar páginas"
msgid "Change or standardize the paper size"
msgstr ""
msgstr "Cambiar o uniformar el tamaño del papel"
msgid "Delete pages"
msgstr ""
msgstr "Eliminar páginas"
msgid "Generate a booklet"
msgstr "Crear un folleto"
msgid "Convert images to PDF"
msgstr ""
msgstr "Convertir imágenes a PDF"
msgid "Edit a PDF"
msgstr ""
msgstr "Editar un PDF"
msgid "Add, edit, or remove metadata from a PDF"
msgstr "Agregar, editar o eliminar metadatos de un PDF"
msgid "Compress and reduce the size of a PDF"
msgstr ""
msgstr "Comprimir y reducir el tamaño de un PDF"
#, php-format
msgid "%s Edit metadata"
@ -209,7 +215,7 @@ msgid "Merge, sort, rotate, delete, extract pages"
msgstr "Fusionar, ordenar, rotar, eliminar, extraer páginas"
msgid "or an image"
msgstr ""
msgstr "o una imagen"
msgid "Touch a page to select it"
msgstr "Toca una página para seleccionarla"
@ -249,12 +255,15 @@ msgid "%s Cancel selection"
msgstr "%s cancelar selección"
msgid "Printing options"
msgstr ""
msgstr "Opciones de impresión"
#, php-format
msgid "%s Download the full PDF"
msgstr "%s Descargar el PDF completo"
msgid "Download the selection"
msgstr "Descargar la selección"
msgid "No"
msgstr "No"
@ -268,9 +277,6 @@ msgstr "Cancelar"
msgid "%s Turn"
msgstr "%s Girar"
msgid "Download the selection"
msgstr "Descargar la selección"
msgid "PDF documents"
msgstr "Documentos PDF"
@ -278,16 +284,37 @@ msgid "Close"
msgstr "Cerrar"
msgid "Original format"
msgstr ""
msgstr "Formato original"
msgid "Most common formats"
msgstr ""
msgstr "Formatos más comunes"
msgid "Other formats"
msgstr ""
msgstr "Otros formatos"
msgid "Custom"
msgstr "Personalizado"
msgid "Paper size"
msgstr ""
msgstr "Tamaño del papel"
msgid "Width"
msgstr "Ancho"
msgid "Height"
msgstr "Alto"
msgid "Unit"
msgstr "Unidad"
msgid "Normal"
msgstr "Normal"
msgid "Booklet"
msgstr "Folleto"
msgid "Formatting"
msgstr "Formateando"
msgid "Sign, initial, stamp, complete a document"
msgstr "Firmar, rubricar, sellar, cumplimentar un documento"
@ -317,7 +344,7 @@ msgid "Close this PDF and return to the homepage"
msgstr "Cerrar este PDF y volver a la página principal"
msgid "PDF Signature"
msgstr "Firma el PDF"
msgstr "PDF Signature"
msgid "This PDF is shared with others to be signed by multiple people"
msgstr "Este PDF se comparte con otros para que lo firmen varias personas"
@ -358,10 +385,10 @@ msgid "%s Check box"
msgstr "%s Casilla de verificación"
msgid "Redaction area"
msgstr ""
msgstr "Área ocultable"
msgid "Watermark"
msgstr ""
msgstr "Marca de agua"
#, php-format
msgid "%s Create an element"
@ -375,7 +402,7 @@ msgid "Download the signed PDF"
msgstr "Descargar el PDF firmado"
msgid "The PDF will be flattened"
msgstr ""
msgstr "El PDF será acoplado"
#, php-format
msgid "You are %s to have signed this PDF"
@ -528,22 +555,23 @@ msgstr ""
"Acabo de firmar el documento (%s) : %s"
msgid "Change the color of the selected element"
msgstr ""
msgstr "Cambiar el color del elemento seleccionado"
msgid "Duplicate the element"
msgstr ""
msgstr "Duplicar el elemento"
msgid "Duplicate on each page"
msgstr ""
msgstr "Duplicar en cada página"
msgid "Duplicate"
msgstr ""
msgstr "Duplicar"
msgid "Delete the element"
msgstr ""
msgstr "Eliminar el elemento"
msgid "Are you sure you want to delete this PDF and the associated signatures?"
msgstr ""
"¿Está seguro que desea eliminar este PDF junto con sus firmas asociadas?"
msgid "Text to modify"
msgstr "Texto a modificar"
@ -582,7 +610,7 @@ msgid "see the source code"
msgstr "ver el código fuente"
msgid "Sign and manipulate PDFs freely"
msgstr ""
msgstr "Firma y maneja archivos PDF libremente"
msgid "Language"
msgstr "Idioma"

Binary file not shown.

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2025-07-05 22:01+0000\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-07-25 22:06+0000\n"
"Last-Translator: xabirequejo <xabi.rn@gmail.com>\n"
"Language-Team: Basque <https://hosted.weblate.org/projects/signature-pdf/"
"application/eu/>\n"
@ -135,6 +135,9 @@ msgstr "Sinatu zerbitzariko ziurtagiriarekin"
msgid "Add a watermark"
msgstr "Gehitu filigrana"
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr "Ezabatu eremuak"
@ -154,11 +157,14 @@ msgid "Rotate pages"
msgstr "Biratu orriak"
msgid "Change or standardize the paper size"
msgstr ""
msgstr "Aldatu edo estandarizatu paperaren neurria"
msgid "Delete pages"
msgstr "Ezabatu orriak"
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr "Bihurtu irudiak PDFra"
@ -254,12 +260,15 @@ msgid "%s Cancel selection"
msgstr "%s Utzi hautaketa"
msgid "Printing options"
msgstr ""
msgstr "Inprimatzeko aukerak"
#, php-format
msgid "%s Download the full PDF"
msgstr "%s Deskargatu PDF osoa"
msgid "Download the selection"
msgstr "Deskargatu hautaketa"
msgid "No"
msgstr "Ez"
@ -273,9 +282,6 @@ msgstr "Utzi"
msgid "%s Turn"
msgstr "%s Biratu"
msgid "Download the selection"
msgstr "Deskargatu hautaketa"
msgid "PDF documents"
msgstr "PDF dokumentuak"
@ -283,15 +289,36 @@ msgid "Close"
msgstr "Itxi"
msgid "Original format"
msgstr ""
msgstr "Jatorrizko formatua"
msgid "Most common formats"
msgstr ""
msgstr "Formatu erabilienak"
msgid "Other formats"
msgstr "Beste formatu batzuk"
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr "Paperaren neurria"
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
@ -547,7 +574,7 @@ msgid "Delete the element"
msgstr "Ezabatu elementua"
msgid "Are you sure you want to delete this PDF and the associated signatures?"
msgstr ""
msgstr "Ziur PDF hau eta erlazionatutako sinadurak ezabatu nahi dituzula?"
msgid "Text to modify"
msgstr "Moldatzeko testua"

Binary file not shown.

View file

@ -8,8 +8,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2025-07-04 13:36+0000\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-08-04 12:37+0000\n"
"Last-Translator: 24ème <equipe@24eme.fr>\n"
"Language-Team: French <https://hosted.weblate.org/projects/signature-pdf/"
"application/fr/>\n"
@ -131,6 +131,9 @@ msgstr "Signer avec le certificat du serveur"
msgid "Add a watermark"
msgstr "Ajouter un filigrane"
msgid "New"
msgstr "Nouveau"
msgid "Redact areas"
msgstr "Caviarder des zones"
@ -150,11 +153,14 @@ msgid "Rotate pages"
msgstr "Pivoter les pages"
msgid "Change or standardize the paper size"
msgstr ""
msgstr "Changer ou uniformiser la dimension des pages"
msgid "Delete pages"
msgstr "Supprimer des pages"
msgid "Generate a booklet"
msgstr "Générer un livret"
msgid "Convert images to PDF"
msgstr "Convertir des images en PDF"
@ -250,12 +256,15 @@ msgid "%s Cancel selection"
msgstr "%s Annuler la sélection"
msgid "Printing options"
msgstr ""
msgstr "Options d'impression"
#, php-format
msgid "%s Download the full PDF"
msgstr "%s Télécharger le PDF complet"
msgid "Download the selection"
msgstr "Télécharger la sélection"
msgid "No"
msgstr "Aucune"
@ -269,9 +278,6 @@ msgstr "Annuler"
msgid "%s Turn"
msgstr "%s Tourner"
msgid "Download the selection"
msgstr "Télécharger la sélection"
msgid "PDF documents"
msgstr "Documents PDF"
@ -279,16 +285,37 @@ msgid "Close"
msgstr "Fermer"
msgid "Original format"
msgstr ""
msgstr "Format original"
msgid "Most common formats"
msgstr ""
msgstr "Formats les plus courants"
msgid "Other formats"
msgstr ""
msgstr "Autres formats"
msgid "Custom"
msgstr "Personnalisé"
msgid "Paper size"
msgstr ""
msgstr "Dimension des pages"
msgid "Width"
msgstr "Largeur"
msgid "Height"
msgstr "Hauteur"
msgid "Unit"
msgstr "Unité"
msgid "Normal"
msgstr "Normale"
msgid "Booklet"
msgstr "Livret"
msgid "Formatting"
msgstr "Formatage"
msgid "Sign, initial, stamp, complete a document"
msgstr "Signer, parapher, tamponner, compléter un document"
@ -545,7 +572,9 @@ msgid "Delete the element"
msgstr "Supprimer l'élément"
msgid "Are you sure you want to delete this PDF and the associated signatures?"
msgstr "Êtes vous sûr de vouloir supprimer ce PDF ainsi que les signatures associées ?"
msgstr ""
"Êtes vous sûr de vouloir supprimer ce PDF ainsi que les signatures "
"associées ?"
msgid "Text to modify"
msgstr "Texte à modifier"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2024-10-14 07:49+0000\n"
"Last-Translator: 24ème <equipe@24eme.fr>\n"
"Language-Team: Galician <https://hosted.weblate.org/projects/signature-pdf/"
@ -130,6 +130,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -154,6 +157,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -255,6 +261,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s Descargar PDF completo"
msgid "Download the selection"
msgstr "Descargar a selección"
msgid "No"
msgstr "Non"
@ -268,9 +277,6 @@ msgstr "Desbotar"
msgid "%s Turn"
msgstr "%s Xirar"
msgid "Download the selection"
msgstr "Descargar a selección"
msgid "PDF documents"
msgstr "Documentos PDF"
@ -286,9 +292,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "Asinar, iniciais, selo, completar un documento"

Binary file not shown.

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2025-07-04 20:01+0000\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-08-14 20:01+0000\n"
"Last-Translator: albanobattistella <albano_battistella@hotmail.com>\n"
"Language-Team: Italian <https://hosted.weblate.org/projects/signature-pdf/"
"application/it/>\n"
@ -130,6 +130,9 @@ msgstr "Firma con il certificato del server"
msgid "Add a watermark"
msgstr "Aggiungi una filigrana"
msgid "New"
msgstr "Nuovo"
msgid "Redact areas"
msgstr "Redigi aree"
@ -149,11 +152,14 @@ msgid "Rotate pages"
msgstr "Ruota le pagine"
msgid "Change or standardize the paper size"
msgstr ""
msgstr "Modificare o standardizzare il formato della carta"
msgid "Delete pages"
msgstr "Elimina pagine"
msgid "Generate a booklet"
msgstr "Genera un libretto"
msgid "Convert images to PDF"
msgstr "Convertire le immagini in PDF"
@ -249,12 +255,15 @@ msgid "%s Cancel selection"
msgstr "%s Annulla selezione"
msgid "Printing options"
msgstr ""
msgstr "Opzioni di stampa"
#, php-format
msgid "%s Download the full PDF"
msgstr "%s Scaricato il PDF completo"
msgid "Download the selection"
msgstr "Scarica la selezione"
msgid "No"
msgstr "No"
@ -268,9 +277,6 @@ msgstr "Annulla"
msgid "%s Turn"
msgstr "%s Ruota"
msgid "Download the selection"
msgstr "Scarica la selezione"
msgid "PDF documents"
msgstr "Documenti PDF"
@ -278,16 +284,37 @@ msgid "Close"
msgstr "Chiudi"
msgid "Original format"
msgstr ""
msgstr "Formato originale"
msgid "Most common formats"
msgstr ""
msgstr "Formati più comuni"
msgid "Other formats"
msgstr ""
msgstr "Altri formati"
msgid "Custom"
msgstr "Personalizzato"
msgid "Paper size"
msgstr ""
msgstr "Formato della carta"
msgid "Width"
msgstr "Larghezza"
msgid "Height"
msgstr "Altezza"
msgid "Unit"
msgstr "Unità"
msgid "Normal"
msgstr "Normale"
msgid "Booklet"
msgstr "Libretto"
msgid "Formatting"
msgstr "Formattazione"
msgid "Sign, initial, stamp, complete a document"
msgstr "Firma, annota, timbra, completa un documento"
@ -541,7 +568,7 @@ msgid "Delete the element"
msgstr "Elimina l'elemento"
msgid "Are you sure you want to delete this PDF and the associated signatures?"
msgstr ""
msgstr "Vuoi davvero eliminare questo PDF e le firme associate?"
msgid "Text to modify"
msgstr "Testo da modificare"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-06-03 16:01+0000\n"
"Last-Translator: ButterflyOfFire <boffire@users.noreply.hosted.weblate.org>\n"
"Language-Team: Kabyle <https://hosted.weblate.org/projects/signature-pdf/"
@ -130,6 +130,9 @@ msgstr "Zmel s uselkin n useqdac"
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -154,6 +157,9 @@ msgstr ""
msgid "Delete pages"
msgstr "Kkes isebtar"
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr "Aselket n tugniwin ɣer PDF"
@ -255,6 +261,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s Sader PDF ummid"
msgid "Download the selection"
msgstr "Sader tafrant"
msgid "No"
msgstr "Uhu"
@ -268,9 +277,6 @@ msgstr "Sefsex"
msgid "%s Turn"
msgstr "%s Dewweṛ"
msgid "Download the selection"
msgstr "Sader tafrant"
msgid "PDF documents"
msgstr "Isemliyen n PDF"
@ -286,9 +292,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "Zmel, zmel deg yidis, err iziwel neɣ smed isemli"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Automatically generated\n"
"Language-Team: none\n"
@ -127,6 +127,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -151,6 +154,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -252,6 +258,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "No"
msgstr ""
@ -265,9 +274,6 @@ msgstr ""
msgid "%s Turn"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "PDF documents"
msgstr ""
@ -283,9 +289,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr ""

Binary file not shown.

View file

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"PO-Revision-Date: 2025-07-05 07:01+0000\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-08-05 21:02+0000\n"
"Last-Translator: Quentin PAGÈS <quentinantonin@free.fr>\n"
"Language-Team: Occitan <https://hosted.weblate.org/projects/signature-pdf/"
"application/oc/>\n"
@ -130,6 +130,9 @@ msgstr "Signar amb lo certificat del servidor"
msgid "Add a watermark"
msgstr "Apondre una filigrana"
msgid "New"
msgstr "Nòu"
msgid "Redact areas"
msgstr "Enfosquir zònas"
@ -149,11 +152,14 @@ msgid "Rotate pages"
msgstr "Pivotar las paginas"
msgid "Change or standardize the paper size"
msgstr ""
msgstr "Modificar o estandardizar la talha del papièr"
msgid "Delete pages"
msgstr "Suprimir de paginas"
msgid "Generate a booklet"
msgstr "Generar un libret"
msgid "Convert images to PDF"
msgstr "Convertir dimatges en PDF"
@ -249,12 +255,15 @@ msgid "%s Cancel selection"
msgstr "%s Anullar la seleccion"
msgid "Printing options"
msgstr ""
msgstr "Opcions d'impression"
#, php-format
msgid "%s Download the full PDF"
msgstr "%s Telecargar lo PDF complèt"
msgid "Download the selection"
msgstr "Telecargar la seleccion"
msgid "No"
msgstr "Non"
@ -268,9 +277,6 @@ msgstr "Anullar"
msgid "%s Turn"
msgstr "%s Virar"
msgid "Download the selection"
msgstr "Telecargar la seleccion"
msgid "PDF documents"
msgstr "Documents PDF"
@ -278,16 +284,37 @@ msgid "Close"
msgstr "Tampar"
msgid "Original format"
msgstr ""
msgstr "Format original"
msgid "Most common formats"
msgstr ""
msgstr "Formats mai comuns"
msgid "Other formats"
msgstr ""
msgstr "Autres formats"
msgid "Custom"
msgstr "Personalizat"
msgid "Paper size"
msgstr ""
msgstr "Talha del papièr"
msgid "Width"
msgstr "Largor"
msgid "Height"
msgstr "Nautor"
msgid "Unit"
msgstr "Unitat"
msgid "Normal"
msgstr "Normala"
msgid "Booklet"
msgstr "Libret"
msgid "Formatting"
msgstr "Formatatge"
msgid "Sign, initial, stamp, complete a document"
msgstr "Signar, parafar, sagelar, completar un document"
@ -544,6 +571,7 @@ msgstr "Suprimir l'element"
msgid "Are you sure you want to delete this PDF and the associated signatures?"
msgstr ""
"Volètz vertadièrament suprimir aqueste PDF e las signaturas associadas ?"
msgid "Text to modify"
msgstr "Tèxt de modificar"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-06-02 13:01+0000\n"
"Last-Translator: Armando Bastoni <weblate@sabato.anonaddy.com>\n"
"Language-Team: Polish <https://hosted.weblate.org/projects/signature-pdf/"
@ -132,6 +132,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -156,6 +159,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr "Przetwórz obraz w dokument PDF"
@ -257,6 +263,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "No"
msgstr ""
@ -270,9 +279,6 @@ msgstr ""
msgid "%s Turn"
msgstr ""
msgid "Download the selection"
msgstr ""
msgid "PDF documents"
msgstr ""
@ -288,9 +294,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr ""

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2024-01-02 19:08+0000\n"
"Last-Translator: Alexandru-Ionut Chiuta <chiuta@gmail.com>\n"
"Language-Team: Romanian <https://hosted.weblate.org/projects/signature-pdf/"
@ -131,6 +131,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -155,6 +158,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -256,6 +262,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s Descărcați PDF-ul complet"
msgid "Download the selection"
msgstr "Descărcați selecția"
msgid "No"
msgstr "Nu"
@ -269,9 +278,6 @@ msgstr "Anulare"
msgid "%s Turn"
msgstr "%s Întoarce"
msgid "Download the selection"
msgstr "Descărcați selecția"
msgid "PDF documents"
msgstr "Documente PDF"
@ -287,9 +293,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "Semnează, inițială, ștampilă, completează un document"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2025-07-06 20:04+0000\n"
"Last-Translator: தமிழ்நேரம் <anishprabu.t@gmail.com>\n"
"Language-Team: Tamil <https://hosted.weblate.org/projects/signature-pdf/"
@ -130,6 +130,9 @@ msgstr "சேவையக சான்றிதழுடன் கையொப
msgid "Add a watermark"
msgstr "ஒரு வாட்டர்மார்க் சேர்க்கவும்"
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr "திருத்தும் பகுதிகள்"
@ -154,6 +157,9 @@ msgstr ""
msgid "Delete pages"
msgstr "பக்கங்களை நீக்கு"
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr "படங்களை PDF ஆக மாற்றவும்"
@ -255,6 +261,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s முழு PDF ஐ பதிவிறக்கவும்"
msgid "Download the selection"
msgstr "தேர்வைப் பதிவிறக்கவும்"
msgid "No"
msgstr "இல்லை"
@ -268,9 +277,6 @@ msgstr "ரத்துசெய்"
msgid "%s Turn"
msgstr "%s"
msgid "Download the selection"
msgstr "தேர்வைப் பதிவிறக்கவும்"
msgid "PDF documents"
msgstr "PDF ஆவணங்கள்"
@ -286,9 +292,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "அடையாளம், ஆரம்ப, முத்திரை, ஒரு ஆவணத்தை முடிக்கவும்"

View file

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-07-10 12:08+0200\n"
"POT-Creation-Date: 2025-08-04 13:21+0200\n"
"PO-Revision-Date: 2023-12-06 14:10+0000\n"
"Last-Translator: Metin Gür <gurmetin@gmail.com>\n"
"Language-Team: Turkish <https://hosted.weblate.org/projects/signature-pdf/"
@ -130,6 +130,9 @@ msgstr ""
msgid "Add a watermark"
msgstr ""
msgid "New"
msgstr ""
msgid "Redact areas"
msgstr ""
@ -154,6 +157,9 @@ msgstr ""
msgid "Delete pages"
msgstr ""
msgid "Generate a booklet"
msgstr ""
msgid "Convert images to PDF"
msgstr ""
@ -255,6 +261,9 @@ msgstr ""
msgid "%s Download the full PDF"
msgstr "%s PDF'in tamamını indirin"
msgid "Download the selection"
msgstr "Seçileni indirin"
msgid "No"
msgstr "Hayır"
@ -268,9 +277,6 @@ msgstr "İptal"
msgid "%s Turn"
msgstr "%s Çevir"
msgid "Download the selection"
msgstr "Seçileni indirin"
msgid "PDF documents"
msgstr "PDF dökümanları"
@ -286,9 +292,30 @@ msgstr ""
msgid "Other formats"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Paper size"
msgstr ""
msgid "Width"
msgstr ""
msgid "Height"
msgstr ""
msgid "Unit"
msgstr ""
msgid "Normal"
msgstr ""
msgid "Booklet"
msgstr ""
msgid "Formatting"
msgstr ""
msgid "Sign, initial, stamp, complete a document"
msgstr "Belgeyi imzalamak, paraflamak, damgalamak, tamamlamak"

View file

@ -1,17 +1,3 @@
@font-face {
font-family: 'Caveat';
font-style: normal;
font-weight: 400;
src: url(/vendor/fonts/Caveat-Regular.ttf) format('truetype');
}
@font-face {
font-family: 'Tajawal';
font-style: normal;
font-weight: 400;
src: url(/vendor/fonts/Tajawal-Medium.ttf) format('truetype');
}
#container-pages {
overflow: auto;
}
@ -74,6 +60,14 @@
opacity: 1;
}
#watermark-color-picker {
display: inline-block; position: absolute; height:28px; width: 28px; border-radius: 24px; top: 5px; right: 6px; z-index: 20;
}
#watermark-color-picker::-moz-color-swatch, #watermark-color-picker::-webkit-color-swatch {
border-radius: 24px;
}
#toolbox div {
cursor: pointer;
padding: 1px;

View file

@ -79,8 +79,14 @@ async function loadFileFromUrl(url, pageUrl, local = null) {
if(response.headers.has('content-disposition') && response.headers.get('Content-Disposition').match(/attachment; filename="/)) {
file_id = response.headers.get('Content-Disposition').replace(/^[^"]*"/, "").replace(/"[^"]*$/, "").replace(/_signe-[0-9]+\x.pdf/, '.pdf');
}
if(pdfBlob.type != 'application/pdf' && pdfBlob.type != 'application/octet-stream') {
filetype = 'application/pdf';
if(pdfBlob.type == 'application/pdf' || pdfBlob.type == 'application/octet-stream') {
filetype = 'application/pdf';
}else if (pdfBlob.type == 'image/jpg' || pdfBlob.type == 'image/jpeg') {
filetype = 'image/jpg';
}else if (pdfBlob.type == 'image/png') {
filetype = 'image/png';
}else{
return;
}
let dataTransfer = new DataTransfer();
@ -88,7 +94,7 @@ async function loadFileFromUrl(url, pageUrl, local = null) {
file_id = local;
}
dataTransfer.items.add(new File([pdfBlob], file_id, {
type: 'application/pdf'
type: filetype
}));
document.getElementById('input_pdf_upload').files = dataTransfer.files;
endLoading()

View file

@ -36,7 +36,10 @@ document.addEventListener('DOMContentLoaded', function () {
fetch(form.action, { method: form.method, body: formData })
.then(async function(response) {
if (response.ok) {
if (response.status == 204 ) {
document.querySelector('#error_message').classList.remove('d-none');
document.querySelector('#error_message').innerText = trad["Your pdf is already optimized"];
} else if (response.ok) {
let filename = response.headers.get('content-disposition').replace('attachment; filename=', '');
let blob = await response.blob();

View file

@ -165,6 +165,27 @@ async function pageRender(pageIndex) {
})
}
window.addEventListener('message', function(event) {
if (event.data.action === 'addMetadata' && event.data.key) {
if (!event.data.value) {
event.data.value = '';
}
console.log('addMetadata via message: '+event.data.key+'='+event.data.value);
input = document.getElementsByName(event.data.key)[0];
if (input) {
input.focus();
if (event.data.value) {
setTimeout('document.getElementsByName("'+event.data.key+'")[0].value = "'+event.data.value+'";', 500);
}
}else{
addMetadata(event.data.key, event.data.value);
setTimeout('document.getElementsByName("'+event.data.key+'")[0].focus();', 100);
}
setIsChanged(true);
}
});
function addMetadata(key, value, type, focus, forceCreation = false) {
if (! forceCreation) {
let input = document.querySelector('.input-metadata input[name="'+key+'"]');
@ -330,7 +351,7 @@ async function pageUpload() {
if(await canUseCache()) {
const file = document.getElementById('input_pdf_upload').files[0]
storeFileInCache(file, file.name);
history.pushState({}, '', '/metadata#'+file.name);
history.pushState({}, '', `${REVERSE_PROXY_URL ? '/': ''}${REVERSE_PROXY_URL}/metadata#${file.name}`);
}
pageMetadata(null);
});

View file

@ -49,15 +49,14 @@ async function loadPDF(pdfBlob, filename, pdfIndex) {
let pageIndex = pdfLetter + "_" + (page.pageNumber - 1);
pages[pageIndex] = page;
const viewportFormat = page.getViewport({ scale: 1 });
const widthFormat = points2mm(viewportFormat.width);
const heightFormat = points2mm(viewportFormat.height);
const format = [widthFormat,heightFormat].sort().join('x')
const format = findFormat(viewportFormat.width, viewportFormat.height);
const formatLibelle = getLibelleFormat(format);
if(!formats[format]) {
formats[format] = []
}
formats[format].push(pageIndex);
let pageTitle = trad['Page'] + ' ' + page.pageNumber + ' - ' + widthFormat + ' x ' + heightFormat + ' mm - ' + filename;
let pageTitle = trad['Page'] + ' ' + page.pageNumber + ' - ' + formatLibelle + ' - ' + filename;
let pageHTML = '<div class="position-relative mt-0 ms-1 me-0 mb-1 canvas-container d-flex align-items-center justify-content-center bg-transparent bg-opacity-25 border border-2 border-transparent" id="canvas-container-' + pageIndex +'" draggable="true">';
pageHTML += '<canvas class="canvas-pdf shadow-sm"></canvas>';
pageHTML += '<div title="' + trad['Select this page'] + '" class="position-absolute top-0 start-50 translate-middle-x p-2 ps-3 pe-3 mt-2 rounded-circle btn-select d-none"><i class="bi bi-check-square"></i></div>';
@ -105,7 +104,7 @@ async function loadPDF(pdfBlob, filename, pdfIndex) {
this.querySelector('.container-resize').classList.add('d-none');
this.querySelector('.canvas-pdf').classList.add('shadow-lg');
this.querySelector('.canvas-pdf').style.border = '2px dashed #777';
e.dataTransfer.setData('element', this.id);
e.dataTransfer.setData(this.id.replace('canvas-container-', ''), '');
this.style.opacity = 0.4;
});
canvasContainer.addEventListener('dragend', function(e) {
@ -120,8 +119,7 @@ async function loadPDF(pdfBlob, filename, pdfIndex) {
e.preventDefault();
}
let pdfOver = this;
let pdfMoving = document.querySelector('#'+e.dataTransfer.getData('element'));
let pdfMoving = document.querySelector('#canvas-container-'+e.dataTransfer.types[0].toUpperCase());
if(pdfOver.id == pdfMoving.id) {
return;
@ -319,21 +317,53 @@ function updateFormats() {
const selectFormatOptionCurrent = document.querySelector('#select_paper_format_current');
let formatsLabel = [];
for(format in formats) {
if(document.querySelector('#select_paper_format option[value="'+format+'"]')) {
formatsLabel.push(document.querySelector('#select_paper_format option[value="'+format+'"]').innerText);
} else {
formatsLabel.push(format.replace('x', ' x ') + ' mm');
}
formatsLabel.push(getLibelleFormat(format));
}
document.querySelector('#input_paper_width').parentNode.classList.add('opacity-75');
document.querySelector('#input_paper_height').parentNode.classList.add('opacity-75');
document.querySelector('#select_size_unit').parentNode.classList.add('opacity-75');
selectFormatOptionCurrent.innerText = formatsLabel.join(', ');
if(selectFormat.value == "custom") {
document.querySelector('#bloc_size').classList.remove('d-none');
document.querySelector('#bloc_size').nextElementSibling.classList.remove('d-none');
document.querySelector('#select_paper_format').selectedOptions[0].text = "Custom";
if(document.querySelector('#input_paper_width').value && document.querySelector('#input_paper_height').value && document.querySelector("#select_size_unit").value) {
document.querySelector('#select_paper_format').selectedOptions[0].text += " ("+document.querySelector('#input_paper_width').value+" x "+ document.querySelector('#input_paper_height').value + " " + document.querySelector("#select_size_unit").value + ")"
}
document.querySelector('#input_paper_width').parentNode.classList.remove('opacity-75');
document.querySelector('#input_paper_height').parentNode.classList.remove('opacity-75');
document.querySelector('#select_size_unit').parentNode.classList.remove('opacity-75');
} else {
document.querySelector('#bloc_size').nextElementSibling.classList.add('d-none');
document.querySelector('#bloc_size').classList.add('d-none');
document.querySelector('#select_paper_format option[value="custom"]').text = "Custom"
}
document.querySelector('#printable_paper_size_infos').innerText = selectFormat.selectedOptions[0].text;
document.querySelector('#printable_paper_size_infos').classList.add('text-muted');
document.querySelector('#printable_paper_size_infos').classList.remove('fw-bold');
if(!selectFormat.value) {
document.querySelector('#input_paper_width').disabled = true;
document.querySelector('#input_paper_height').disabled = true;
document.querySelector('#select_size_unit').disabled = true;
document.querySelector('#input_paper_width').value = null;
document.querySelector('#input_paper_height').value = null;
document.querySelector('#select_size_unit').value = null;
}
if(selectFormat.value) {
document.querySelector('#printable_paper_size_infos').classList.remove('text-muted');
document.querySelector('#printable_paper_size_infos').classList.add('fw-bold');
document.querySelector('#input_paper_width').disabled = false;
document.querySelector('#input_paper_height').disabled = false;
document.querySelector('#select_size_unit').disabled = false;
}
if(selectFormat.value && selectFormat.value.match(/[0-9\.]+x[0-9\.]+x/)) {
document.querySelector('#input_paper_width').value = selectFormat.value.split('x')[0];
document.querySelector('#input_paper_height').value = selectFormat.value.split('x')[1];
document.querySelector('#select_size_unit').value = selectFormat.value.split('x')[2];
}
document.querySelector('#printable_paper_size_infos').title = document.querySelector('#printable_paper_size_infos').innerText;
document.querySelector('#printable_formatting_infos').innerText = null;
@ -342,6 +372,29 @@ function updateFormats() {
}
}
function findFormat(pointWidth, pointHeight) {
const format_in = points2unit(pointWidth, 'in')+'x'+points2unit(pointHeight, 'in')+'xin'
if(document.querySelector('#select_paper_format option[value="'+format_in+'"]')) {
return format_in;
}
const format_mm = points2unit(pointWidth, 'mm')+'x'+points2unit(pointHeight, 'mm')+'xmm'
return format_mm;
}
function getLibelleFormat(format) {
if(document.querySelector('#select_paper_format option[value="'+format+'"]')) {
return document.querySelector('#select_paper_format option[value="'+format+'"]').innerText
}
const splitFormat = format.split('x');
return splitFormat[0] + ' x ' + splitFormat[1] + ' ' + splitFormat[2];
}
function getPagesSelected() {
let pages = [];
document.querySelectorAll('.canvas-container .input-select:checked').forEach(function(item) {
@ -642,15 +695,14 @@ async function save(order) {
const pageOrganize = pagesOrganize[i].split('-')[0];
const rotation = pagesOrganize[i].split('-')[1];
const pdfPage = pages[pageOrganize];
const format = document.querySelector('#select_paper_format').value;
if(rotation) {
pdfPage.setRotation(window['PDFLib'].degrees(parseInt(rotation)));
}
if(format) {
let width = mm2points(parseInt(format.split("x")[0]));
let height = mm2points(parseInt(format.split("x")[1]));
if(pdfPage.getHeight() > pdfPage.getWidth()) {
if(document.querySelector('#input_paper_width').value && document.querySelector('#input_paper_height').value, document.querySelector('#select_size_unit').value) {
let unit = document.querySelector('#select_size_unit').value;
let width = unit2points(parseFloat(document.querySelector('#input_paper_width').value), unit);
let height = unit2points(parseFloat(document.querySelector('#input_paper_height').value), unit);
if(document.querySelector('#select_paper_format').value != "custom" && 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));
@ -690,49 +742,65 @@ async function save(order) {
await storeFileInCache(newPDF, filename+'.pdf');
}
function unit2points(value, unit) {
if(unit == 'mm') {
return mm2points(value);
}
if(unit == 'in') {
return in2points(value);
}
return value;
}
function mm2points(mm) {
return mm * 72 / 25.4;
}
function in2points(inch) {
return inch * 72;
}
function points2unit(value, unit) {
if(unit == 'mm') {
return points2mm(value);
}
if(unit == 'in') {
return points2in(value);
}
return value;
}
function points2mm(points) {
return Math.round(points * 25.4 / 72);
}
function points2in(points) {
return Math.round(points / 72 * 10) / 10;
}
async function merge2Pages(pdf, pageA, pageB, pageWidth, pageHeight) {
const newPageWidth = Math.max(pageWidth, pageHeight);
const newPageHeight = Math.min(pageWidth, pageHeight);
const page = pdf.addPage([newPageWidth, newPageHeight]);
if(pageA) {
resizePage(pageA, newPageWidth / 2, newPageHeight);
const pageEmbeddedA = await pdf.embedPage(pageA, {
left: 0,
bottom: 0,
right: pageA.getWidth(),
top: pageA.getHeight(),
});
page.drawPage(pageEmbeddedA, {
width: pageEmbeddedA.width,
height: pageEmbeddedA.height,
x: 0,
y: 0,
});
await embedPage(pdf, page, pageA, 0, 0);
}
if(pageB) {
resizePage(pageB, newPageWidth / 2, newPageHeight);
const pageEmbeddedB = await pdf.embedPage(pageB, {
left: 0,
bottom: 0,
right: pageB.getWidth(),
top: pageB.getHeight(),
});
page.drawPage(pageEmbeddedB, {
width: pageEmbeddedB.width,
height: pageEmbeddedB.height,
x: newPageWidth / 2,
y: 0,
});
await embedPage(pdf, page, pageB, newPageWidth / 2, 0);
}
}
@ -759,6 +827,21 @@ function resizePage(page, newWidth, newHeight) {
page.translateContent(offsetX, offsetY);
}
async function embedPage(pdf, page, pageToEmbed, x, y) {
const pageEmbedded = await pdf.embedPage(pageToEmbed, {
left: 0,
bottom: 0,
right: pageToEmbed.getWidth(),
top: pageToEmbed.getHeight(),
});
page.drawPage(pageEmbedded, {
width: pageEmbedded.width,
height: pageEmbedded.height,
x: x,
y: y,
});
}
function cleanPDF(pdf) {
let pagesRef = [];
for(page of pdf.getPages()) {
@ -932,7 +1015,8 @@ function createEventsListener() {
document.querySelector('#btn_liste_pdf').click();
});
document.querySelector('body').addEventListener('click', function(event) {
if(!event.originalTarget.classList.contains('offcanvas-header') && !event.originalTarget.classList.contains('offcanvas-body') && event.originalTarget.id != 'container-pages' && event.originalTarget.id != 'sidebarTools' && event.originalTarget.id != 'sidebarToolsLabel' && event.originalTarget.id != 'btn_container') {
if (!(event.target instanceof Element)) return;
if(!event.target.classList.contains('offcanvas-header') && !event.target.classList.contains('offcanvas-body') && event.target.id != 'container-pages' && event.target.id != 'sidebarTools' && event.target.id != 'sidebarToolsLabel' && event.target.id != 'btn_container') {
return;
}
document.getElementById('btn_cancel_select').click();
@ -943,6 +1027,13 @@ function createEventsListener() {
document.querySelector('#select_formatting').addEventListener('change', function(event) {
updateFormats();
});
document.querySelector('#bloc_size').addEventListener('change', function(event) {
if(!["input_paper_width", "input_paper_height", "select_size_unit"].includes(event.target.id)) {
return;
}
document.querySelector('#select_paper_format').value = "custom";
updateFormats();
});
}
async function uploadFromUrl(url) {

View file

@ -497,7 +497,7 @@ function updateWatermark() {
return
}
const text = new fabric.Text(document.querySelector('input[name=watermark]').value, {angle: -40, fill: "#0009", fontSize: 27 * currentScale})
const text = new fabric.Text(document.querySelector('input[name=watermark]').value, {angle: -40, fill: document.querySelector("#watermark-color-picker").value, fontSize: 27 * currentScale})
text.scale = 0.
const overlay = new fabric.Rect({
fill: new fabric.Pattern({
@ -870,7 +870,7 @@ function createEventsListener() {
input.classList.remove('d-none')
div.classList.add('d-none')
input.querySelector('input').focus()
input.querySelector('input[type=text]').focus()
})
document.querySelector('input[name=watermark]')?.addEventListener('keyup', debounce(function (e) {
@ -885,6 +885,10 @@ function createEventsListener() {
updateWatermark();
});
document.querySelector('#watermark-color-picker')?.addEventListener('change', function (e) {
document.querySelector('input[name=watermark]').dispatchEvent(new Event("change"));
});
if(document.querySelector('#alert-signature-help')) {
document.getElementById('btn-signature-help').addEventListener('click', function(event) {
document.querySelector('#alert-signature-help').classList.remove('d-none');
@ -898,7 +902,9 @@ function createEventsListener() {
if(document.getElementById('save')) {
document.getElementById('save').addEventListener('click', async function(event) {
event.preventDefault()
if(!pdfHash) {
event.preventDefault()
}
let previousScale = currentScale;
if(currentScale != defaultScale) {
@ -917,16 +923,20 @@ function createEventsListener() {
resizeTimeout = setTimeout(resizePDF(previousScale), 100);
}
const formData = new FormData(this.form)
const response = await fetch(this.form.action, {
method: "POST",
body: formData
})
if(!pdfHash) {
startProcessingMode(this)
const formData = new FormData(this.form)
const response = await fetch(this.form.action, {
method: "POST",
body: formData
})
const blob = await response.blob()
const filename = response.headers.get('Content-Disposition').split('"')[1]
download(blob, filename)
storeFileInCache(blob, formData.get('pdf').name)
const blob = await response.blob()
const filename = response.headers.get('Content-Disposition').split('"')[1]
await download(blob, filename)
await storeFileInCache(blob, formData.get('pdf').name)
endProcessingMode(this)
}
hasModifications = false;
});
@ -957,6 +967,9 @@ function createEventsListener() {
document.getElementById('save_mobile').addEventListener('click', function(event) {
document.getElementById('save').click();
event.preventDefault();
return false;
});
document.getElementById('btn-svg-pdf-delete').addEventListener('click', function(event) {
@ -1163,7 +1176,8 @@ async function pageUpload() {
if(await canUseCache()) {
const file = document.getElementById('input_pdf_upload').files[0]
storeFileInCache(file, file.name);
history.pushState({}, '', '/signature#'+file.name);
//history.pushState({}, '', `${REVERSE_PROXY_URL ? '/': ''}${REVERSE_PROXY_URL}/signature#${file.name}`);
history.pushState({}, '', `${REVERSE_PROXY_URL}/signature#${encodeURIComponent(file.name)}`);
}
pageSignature(null);
});

View file

@ -21,6 +21,7 @@
<?php endif; ?>
<script src="<?php echo $REVERSE_PROXY_URL; ?>/js/common.js?<?php echo ($COMMIT) ? $COMMIT : filemtime($ROOT."/public/js/common.js") ?>"></script>
<script>
var REVERSE_PROXY_URL = <?php echo json_encode($REVERSE_PROXY_URL); ?>;
var trad = <?php echo json_encode([
'Select this page' => _('Select this page'),
'Delete this page' => _('Delete this page'),

View file

@ -8,3 +8,18 @@
<?php endif; ?>
<link rel="icon" type="image/x-icon" href="<?php echo $REVERSE_PROXY_URL; ?>/favicon.ico">
<link rel="icon" type="image/png" sizes="192x192" href="<?php echo $REVERSE_PROXY_URL; ?>/favicon.png" />
<style>
@font-face {
font-family: 'Caveat';
font-style: normal;
font-weight: 400;
src: url('<?php echo $REVERSE_PROXY_URL; ?>/vendor/fonts/Caveat-Regular.ttf') format('truetype');
}
@font-face {
font-family: 'Tajawal';
font-style: normal;
font-weight: 400;
src: url('<?php echo $REVERSE_PROXY_URL; ?>/vendor/fonts/Tajawal-Medium.ttf') format('truetype');
}
</style>

View file

@ -51,6 +51,9 @@
<?php include('components/common.html.php'); ?>
<script>
var maxSize = <?php echo $maxSize ?>;
var trad = <?php echo json_encode([
'Your pdf is already optimized' => _("Your pdf is already optimized")
]); ?>;
</script>
<script src="<?php echo $REVERSE_PROXY_URL; ?>/js/compress.js?<?php echo ($COMMIT) ? $COMMIT : filemtime($ROOT."/public/js/compress.js") ?>"></script>
</body>

View file

@ -140,26 +140,52 @@
<option id="select_paper_format_current" value="" selected></option>
</optgroup>
<optgroup label="<?php echo _("Most common formats") ?>">
<option value="210x297">A4 (210 × 297 mm)</option>
<option value="216x279">Letter (8.5 × 11 pouces / 216 × 279 mm)</option>
<option value="210x297xmm">A4 (210 × 297 mm)</option>
<option value="8.5x11xin">Letter (8.5 × 11 in)</option>
</optgroup>
<optgroup label="<?php echo _("Other formats") ?>">
<option value="841x1189">A0 (841 × 1189 mm)</option>
<option value="594x841">A1 (594 × 841 mm)</option>
<option value="420x594">A2 (420 × 594 mm)</option>
<option value="297x420">A3 (297 × 420 mm)</option>
<option value="210x297">A4 (210 × 297 mm)</option>
<option value="148x210">A5 (148 × 210 mm)</option>
<option value="105x148">A6 (105 × 148 mm)</option>
<option value="250x353">B4 (250 × 353 mm)</option>
<option value="176x250">B5 (176 × 250 mm)</option>
<option value="216x356">Legal (8.5 × 14 pouces / 216 × 356 mm)</option>
<option value="279x432">Tabloid (11 × 17 pouces / 279 × 432 mm)</option>
<!--<option value="custom">Other Custom ...</option>-->
<option value="841x1189xmm">A0 (841 × 1189 mm)</option>
<option value="594x841xmm">A1 (594 × 841 mm)</option>
<option value="420x594xmm">A2 (420 × 594 mm)</option>
<option value="297x420xmm">A3 (297 × 420 mm)</option>
<option value="210x297xmm">A4 (210 × 297 mm)</option>
<option value="148x210xmm">A5 (148 × 210 mm)</option>
<option value="105x148xmm">A6 (105 × 148 mm)</option>
<option value="250x353xmm">B4 (250 × 353 mm)</option>
<option value="176x250xmm">B5 (176 × 250 mm)</option>
<option value="8.5x11xin">Letter (8.5 × 11 in)</option>
<option value="8.5x14xin">Legal (8.5 × 14 in)</option>
<option value="11x17xin">Tabloid (11 × 17 in)</option>
<option value="custom"><?php echo _("Custom") ?></option>
</optgroup>
</select>
<label for="select-format"><?php echo _("Paper size") ?></label>
</div>
<div id="bloc_size" class="row mt-3 d-none">
<div class="col">
<div class="form-floating">
<input type="number" class="form-control" id="input_paper_width" value="">
<label for="input_paper_width"><?php echo _("Width") ?></label>
</div>
</div>
<div class="col">
<div class="form-floating">
<input type="number" class="form-control" id="input_paper_height" value="">
<label for="input_paper_height"><?php echo _("Height") ?></label>
</div>
</div>
<div class="col">
<div class="form-floating">
<select class="form-select" id="select_size_unit">
<option value=""></option>
<option value="mm">mm</option>
<option value="in">in</option>
</select>
<label for="floatingInputGrid"><?php echo _("Unit") ?></label>
</div>
</div>
</div>
<hr class="d-none" />
<div class="form-floating mt-3">
<select class="form-select" id="select_formatting">
<option value="" selected><?php echo _("Normal") ?></option>

View file

@ -91,8 +91,9 @@
<div class="input-watermark-placeholder btn btn-outline-secondary w-100 text-start text-dark">
<span class="bi bi-droplet-half" id="watermark-addon"></span> <?php echo _("Watermark") ?>
</div>
<div class="input-group d-none">
<div class="input-group d-none position-relative">
<span class="input-group-text border-secondary"><i class="bi bi-droplet-half"></i></span>
<input type="color" id="watermark-color-picker" class="form-control form-control-color" value="#828282">
<input form="form_pdf" type="text" class="form-control border-secondary" name="watermark" placeholder="<?php echo _("Watermark") ?>" aria-label="Watermark" aria-describedby="watermark-addon">
</div>
<?php endif ?>
@ -350,11 +351,11 @@
]); ?>;
<?php if ($TRANSLATION_LANGUAGE == 'ar'): ?>
url_font = <?php echo json_encode('/vendor/fonts/Tajawal-Medium.ttf') ?>
url_font = <?php echo json_encode((!empty($REVERSE_PROXY_URL) ? '/': '') . $REVERSE_PROXY_URL . '/vendor/fonts/Tajawal-Medium.ttf') ?>
<?php elseif ($TRANSLATION_LANGUAGE == 'kab'): ?>
url_font = <?php echo json_encode('/vendor/fonts/FiraSans-MediumItalic.ttf') ?>
url_font = <?php echo json_encode((!empty($REVERSE_PROXY_URL) ? '/': '') . $REVERSE_PROXY_URL . '/vendor/fonts/FiraSans-MediumItalic.ttf') ?>
<?php else: ?>
url_font = <?php echo json_encode('/vendor/fonts/Caveat-Regular.ttf') ?>
url_font = <?php echo json_encode((!empty($REVERSE_PROXY_URL) ? '/': '') . $REVERSE_PROXY_URL . '/vendor/fonts/Caveat-Regular.ttf') ?>
<?php endif; ?>
</script>
<script src="<?php echo $REVERSE_PROXY_URL; ?>/js/signature.js?<?php echo ($COMMIT) ? $COMMIT : filemtime($ROOT."/public/js/signature.js") ?>"></script>