Skip to content

Commit

Permalink
Merge branch 'master' of github.com:24eme/signaturepdf
Browse files Browse the repository at this point in the history
  • Loading branch information
tale-fau committed Feb 16, 2024
2 parents 4b82dae + 58ec504 commit 9edcac9
Show file tree
Hide file tree
Showing 37 changed files with 1,946 additions and 146 deletions.
3 changes: 3 additions & 0 deletions README.fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Liste des instances permettant d'utiliser ce logiciel :
- [pdf.libreon.fr](https://pdf.libreon.fr)
- [pdf.hostux.net](https://pdf.hostux.net)
- [pdf.nebulae.co](https://pdf.nebulae.co)
- [pdf.kaosx.ovh](https://pdf.kaosx.ovh)
- [pdf.ti-nuage.fr](https://pdf.ti-nuage.fr)
- [pdf.cemea.org](https://pdf.cemea.org)

_N'hésitez pas à rajouter la votre via une issue ou une pull request_

Expand Down
13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ List of instances where you can use this software:
- [pdf.libreon.fr](https://pdf.libreon.fr)
- [pdf.hostux.net](https://pdf.hostux.net)
- [pdf.nebulae.co](https://pdf.nebulae.co)
- [pdf.kaosx.cf](https://pdf.kaosx.cf)
- [pdf.kaosx.ovh](https://pdf.kaosx.ovh)
- [pdf.ti-nuage.fr](https://pdf.ti-nuage.fr)
- [pdf.cemea.org](https://pdf.cemea.org)
- [pdf.spirio.fr](https://pdf.spirio.fr)

_Feel free to add yours through an issue or a pull request._

Expand All @@ -32,13 +35,10 @@ Open-source software under the AGPL V3 license.
- [Contributors](#contributors)
- [Fundings](#fundings)
- [Screenshots](#screenshots)
<<<<<<< HEAD
=======
- [Signature feature](#signature-feature)
- [Organizing feature](#organizing-feature)
- [Metadata feature](#metadata-feature)
- [Compression feature](#compression-feature)
>>>>>>> 6f677d88b834018412ab55101942c97b3213743b


## Installation
Expand Down Expand Up @@ -139,7 +139,6 @@ DEBUG=1 make test
- **ImageMagick** Image manipulation toolset: https://imagemagick.org/ (Apache-2.0)
- **Caveat** Handwriting-style font: https://github.com/googlefonts/caveat (OFL-1.1)
- **PDF-LIB** JavaScript library for PDF manipulation used for writing metadata: https://pdf-lib.js.org/ (MIT)
- **PDF-LIB** JavaScript library for PDF manipulation used for writing metadata: https://pdf-lib.js.org/ (MIT)
- **Ghostscript** GPL Ghostscript is a software suite for processing PostScript and PDF file formats (GPLv3)

For testing:
Expand Down Expand Up @@ -170,9 +169,6 @@ Vincent LAURENT (24ème), Jean-Baptiste Le Metayer (24ème), Xavier Garnier (Log
- 100 € excl. taxes donations from the company PDG IT
- 1 040 € excl. taxes from the foundation NLNet pour software internationalization

<<<<<<< HEAD
The development of the software was primarily done during the working hours of 24ème employees.
=======
The development of the software was primarily done during the working hours of 24ème employees.

## Screenshots
Expand All @@ -198,4 +194,3 @@ The development of the software was primarily done during the working hours of 2
### Compression feature

![image](https://github.com/24eme/signaturepdf/assets/71143205/7d0e93a3-5567-4545-9c43-033b9028b036)
>>>>>>> 6f677d88b834018412ab55101942c97b3213743b
54 changes: 8 additions & 46 deletions app.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
}

$f3->set('SUPPORTED_LANGUAGES',
['fr' => 'Français',
'en' => 'English',
[
'ar' => 'العربية',
'de' => 'Deutsch',
'en' => 'English',
'fr' => 'Français',
'it' => 'Italiano',
'kab' => 'Taqbaylit',
'oc' => 'Occitan',
'it' => 'Italiano']);
'ro' => 'Română',
'tr' => 'Türkçe'
]);

$f3->set('XFRAME', null); // Allow use in an iframe
$f3->set('ROOT', __DIR__);
Expand Down Expand Up @@ -365,54 +370,11 @@ function($f3) {
if (!$f3->get('disableOrganization')) {
$f3->route('GET /organization',
function($f3) {
$f3->set('maxSize', min(array(convertPHPSizeToBytes(ini_get('post_max_size')), convertPHPSizeToBytes(ini_get('upload_max_filesize')))));

$f3->set('activeTab', 'organize');
echo View::instance()->render('organization.html.php');
}
);

$f3->route('POST /organize',
function($f3) {
$filenames = array();
$tmpfile = tempnam($f3->get('UPLOADS'), 'pdfsignature_organize');
unlink($tmpfile);
$pages = explode(',', preg_replace('/[^A-Z0-9a-z,]+/', '', $f3->get('POST.pages')));

$files = Web::instance()->receive(function($file,$formFieldName){
if(strpos(Web::instance()->mime($file['tmp_name'], true), 'application/pdf') !== 0) {
$f3->error(403);
}

return true;
}, false, function($fileBaseName, $formFieldName) use ($tmpfile, &$filenames) {
$filenames[] = str_replace('.pdf', '', $fileBaseName);

return basename($tmpfile).uniqid().".pdf";
});

if(!count($files)) {
$f3->error(403);
}

$pdfs = array();
foreach(array_keys($files) as $i => $file) {
$pdfs[] = chr(65 + $i)."=".$file;
}

shell_exec(sprintf("pdftk %s cat %s output %s", implode(" ", $pdfs), implode(" ", $pages), $tmpfile.'_final.pdf'));

Web::instance()->send($tmpfile."_final.pdf", null, 0, TRUE, implode('_', $filenames));

if($f3->get('DEBUG')) {
return;
}

array_map('unlink', glob($tmpfile."*"));
}
);
}

$f3->route('GET /metadata',
function($f3) {
$f3->set('activeTab','metadata');
Expand Down
24 changes: 20 additions & 4 deletions installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Dependencies:

Installing dependencies:
```
sudo aptitude install php librsvg2-bin pdftk imagemagick potrace ghostscript locales
sudo apt-get install php librsvg2-bin pdftk imagemagick potrace ghostscript locales
```

Getting the source code:
Expand All @@ -28,15 +28,15 @@ To run it:
php -S localhost:8000 -t public
```

#### PHP Configuration
### PHP Configuration

```
upload_max_filesize = 24M # Maximum size of the PDF file to sign
post_max_size = 24M # Maximum size of the PDF file to sign
max_file_uploads = 201 # Maximum number of pages in the PDF, here 200 pages + the original PDF
```

#### Apache Configuration
### Apache Configuration

```
DocumentRoot /path/to/signaturepdf/public
Expand All @@ -48,7 +48,24 @@ DocumentRoot /path/to/signaturepdf/public
php_value post_max_size 24M
</Directory>
```
### Troubleshooting

#### The translation is not done

The language remains in English in the interface.

Check that your locales are properly installed:

```
sudo apt-get install locales
sudo dpkg-reconfigure locales
```

Then if you use apache, you have to restart it:

```
sudo service apache2 restart
```

## [Deploy with Docker](#docker)

Expand Down Expand Up @@ -85,7 +102,6 @@ The following variables can be used to configure the deployment:
docker run -d --name=signaturepdf -p 8080:80 -e SERVERNAME=pdf.example.org -e UPLOAD_MAX_FILESIZE=48M -e POST_MAX_SIZE=48M -e MAX_FILE_UPLOADS=401 -e PDF_STORAGE_PATH=/data signaturepdf
```


## [Alpine](#alpine)

Here is a script to install the solution on Linux Alpine (tested with version 3.15).
Expand Down
6 changes: 4 additions & 2 deletions locale/application.pot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-24 17:35+0200\n"
"POT-Creation-Date: 2024-02-08 23:06+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -179,7 +179,6 @@ msgstr ""
msgid "%s Turn"
msgstr ""

#, php-format
msgid "Download the selection"
msgstr ""

Expand Down Expand Up @@ -269,6 +268,9 @@ msgstr ""
msgid "%s Text"
msgstr ""

msgid "Strikethrough"
msgstr ""

#, php-format
msgid "%s Check box"
msgstr ""
Expand Down
Binary file modified locale/ar/LC_MESSAGES/application.mo
Binary file not shown.
12 changes: 7 additions & 5 deletions locale/ar/LC_MESSAGES/application.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-24 17:21+0200\n"
"PO-Revision-Date: 2023-09-29 08:55+0000\n"
"POT-Creation-Date: 2024-02-08 23:02+0100\n"
"PO-Revision-Date: 2023-11-18 05:03+0000\n"
"Last-Translator: ButterflyOfFire <[email protected]>\n"
"Language-Team: Arabic <https://hosted.weblate.org/projects/signature-pdf/"
"application/ar/>\n"
Expand All @@ -18,7 +18,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 ? 4 : 5;\n"
"X-Generator: Weblate 5.1-dev\n"
"X-Generator: Weblate 5.2\n"

msgid "en"
msgstr "ar"
Expand Down Expand Up @@ -50,7 +50,7 @@ msgid ""
msgstr "سيتم معالجة ملف PDF على الخادم دون الاحتفاظ به أو تخزينه"

msgid "Your pdf is already optimized"
msgstr ""
msgstr "ملف PDF الخاص بك بالفعل أمثل"

msgid "Compress"
msgstr "ضغط"
Expand Down Expand Up @@ -182,7 +182,6 @@ msgstr "إلغاء"
msgid "%s Turn"
msgstr "%s دوران"

#, php-format
msgid "Download the selection"
msgstr "تنزيل المُحدَّدة"

Expand Down Expand Up @@ -272,6 +271,9 @@ msgstr "%s خاتَم"
msgid "%s Text"
msgstr "%s نص"

msgid "Strikethrough"
msgstr ""

#, php-format
msgid "%s Check box"
msgstr "%s خانة اختيار"
Expand Down
Binary file added locale/br/LC_MESSAGES/application.mo
Binary file not shown.
Loading

0 comments on commit 9edcac9

Please sign in to comment.