diff --git a/.gitignore b/.gitignore
index 1ae4b51..e62f8c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,3 +5,4 @@
/public_html/js
/node_modules
/backup
+/tmp
\ No newline at end of file
diff --git a/composer.json b/composer.json
index 48161df..4970e9e 100644
--- a/composer.json
+++ b/composer.json
@@ -27,6 +27,8 @@
"require": {
"phpoffice/phpspreadsheet": "^1.1",
"phpstan/phpstan": "^0.9.2",
- "ifsnop/mysqldump-php": "2.*"
+ "ifsnop/mysqldump-php": "2.*",
+ "setasign/fpdf": "1.8.1",
+ "mpdf/mpdf": "^7.0"
}
}
diff --git a/composer.lock b/composer.lock
index fb9984d..ea913c3 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "content-hash": "28e31e7da9313d9726a26a4f36bf06a3",
+ "content-hash": "d300af5ed297b7cdfbfda9d2604a8f95",
"packages": [
{
"name": "ifsnop/mysqldump-php",
@@ -109,6 +109,73 @@
],
"time": "2018-01-21T13:54:22+00:00"
},
+ {
+ "name": "mpdf/mpdf",
+ "version": "v7.0.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/mpdf.git",
+ "reference": "5681a0cae1eea197143d5d27f06e19b0523cd8d6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/mpdf/zipball/5681a0cae1eea197143d5d27f06e19b0523cd8d6",
+ "reference": "5681a0cae1eea197143d5d27f06e19b0523cd8d6",
+ "shasum": ""
+ },
+ "require": {
+ "ext-gd": "*",
+ "ext-mbstring": "*",
+ "paragonie/random_compat": "^1.4|^2.0",
+ "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0",
+ "psr/log": "^1.0",
+ "setasign/fpdi": "1.6.*"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.5",
+ "phpunit/phpunit": "^5.0",
+ "squizlabs/php_codesniffer": "^2.7.0",
+ "tracy/tracy": "^2.4"
+ },
+ "suggest": {
+ "ext-bcmath": "Needed for generation of some types of barcodes",
+ "ext-xml": "Needed mainly for SVG manipulation",
+ "ext-zlib": "Needed for compression of embedded resources, such as fonts"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-development": "7.0-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0"
+ ],
+ "authors": [
+ {
+ "name": "Matěj Humpál",
+ "role": "Developer, maintainer"
+ },
+ {
+ "name": "Ian Back",
+ "role": "Developer (retired)"
+ }
+ ],
+ "description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
+ "homepage": "https://mpdf.github.io",
+ "keywords": [
+ "pdf",
+ "php",
+ "utf-8"
+ ],
+ "time": "2018-01-03T07:32:36+00:00"
+ },
{
"name": "nette/bootstrap",
"version": "v2.4.5",
@@ -673,6 +740,54 @@
"description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)",
"time": "2018-02-05T13:05:30+00:00"
},
+ {
+ "name": "paragonie/random_compat",
+ "version": "v2.0.11",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/random_compat.git",
+ "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
+ "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.2.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*|5.*"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "lib/random.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "security@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+ "keywords": [
+ "csprng",
+ "pseudorandom",
+ "random"
+ ],
+ "time": "2017-09-27T21:40:39+00:00"
+ },
{
"name": "phpoffice/phpspreadsheet",
"version": "1.2.0",
@@ -867,6 +982,53 @@
"description": "PHPStan - PHP Static Analysis Tool",
"time": "2018-01-28T13:22:19+00:00"
},
+ {
+ "name": "psr/log",
+ "version": "1.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "Psr/Log/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2016-10-10T12:19:37+00:00"
+ },
{
"name": "psr/simple-cache",
"version": "1.0.1",
@@ -915,6 +1077,94 @@
],
"time": "2017-10-23T01:57:42+00:00"
},
+ {
+ "name": "setasign/fpdf",
+ "version": "1.8.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Setasign/FPDF.git",
+ "reference": "2c68c9e6c034ac3187d25968790139a73184cdb1"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Setasign/FPDF/zipball/2c68c9e6c034ac3187d25968790139a73184cdb1",
+ "reference": "2c68c9e6c034ac3187d25968790139a73184cdb1",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "fpdf.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "no usage restriction"
+ ],
+ "authors": [
+ {
+ "name": "Olivier Plathey",
+ "email": "oliver@fpdf.org",
+ "homepage": "http://fpdf.org/"
+ }
+ ],
+ "description": "FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.",
+ "homepage": "http://www.fpdf.org",
+ "keywords": [
+ "fpdf",
+ "pdf"
+ ],
+ "time": "2016-01-01T17:47:15+00:00"
+ },
+ {
+ "name": "setasign/fpdi",
+ "version": "1.6.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Setasign/FPDI.git",
+ "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
+ "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea",
+ "shasum": ""
+ },
+ "suggest": {
+ "setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
+ "setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
+ "setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "filters/",
+ "fpdi.php",
+ "fpdf_tpl.php",
+ "fpdi_pdf_parser.php",
+ "pdf_context.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Slabon",
+ "email": "jan.slabon@setasign.com",
+ "homepage": "https://www.setasign.com"
+ }
+ ],
+ "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
+ "homepage": "https://www.setasign.com/fpdi",
+ "keywords": [
+ "fpdf",
+ "fpdi",
+ "pdf"
+ ],
+ "time": "2017-05-11T14:25:49+00:00"
+ },
{
"name": "symfony/console",
"version": "v4.0.6",
diff --git a/public_html/font/FiraSans-Regular.ttf b/public_html/font/FiraSans-Regular.ttf
new file mode 100644
index 0000000..d9fdc0e
Binary files /dev/null and b/public_html/font/FiraSans-Regular.ttf differ
diff --git a/public_html/pdf.php b/public_html/pdf.php
new file mode 100644
index 0000000..fb8453d
--- /dev/null
+++ b/public_html/pdf.php
@@ -0,0 +1,231 @@
+getDefaults();
+ $fontDirs = $defaultConfig['fontDir'];
+
+ /* (2) Get Font data */
+ $defaultFontConfig = (new Mpdf\Config\FontVariables())->getDefaults();
+ $fontData = $defaultFontConfig['fontdata'];
+
+ /* (3) Create PDF file */
+ $pdf = new \Mpdf\Mpdf([
+ 'mode' => 'utf-8',
+ 'defaultCssFile' => __PUBLIC__.'/css/pdf.css',
+ 'tempDir' => __ROOT__.'/tmp',
+ 'fontDir' => array_merge($fontDirs, [ __PUBLIC__.'/font/' ]),
+ 'fontdata' => $fontData + [
+ 'Fira Sans' => [
+ 'R' => 'FiraSans-Regular.ttf'
+ ]
+ ],
+ 'default_font' => 'Fira Sans'
+ ]);
+
+ /* (4) Set PDF title */
+ $pdf->SetTitle('Some PDF title');
+
+ /* (5) Store SVG */
+ $svg_warning = '';
+
+
+
+
+ /* (2) Set Header|Footer
+ ---------------------------------------------------------*/
+ /* (1) Set Header content (Left, Right) */
+ $header_content = [
+ 'C' => [ 'color' => '#aaa', 'content' => 'Fiche enseignant Sophie Gouardères (sgouarde)' ],
+ 'line' => 1
+ ];
+
+ /* (2) Apply Header */
+ $pdf->setHeader([
+ 'odd' => $header_content,
+ 'even' => $header_content
+ ]);
+
+ /* (1) Set Footer content (Left, Right) */
+ $footer_content = [
+ 'L' => [ 'color' => '#aaa', 'content' => 'Généré le @date_création' ],
+ 'R' => [ 'color' => '#aaa', 'content' => 'Page {PAGENO} sur {nbpg}' ],
+ 'line' => 1
+ ];
+
+ /* (2) Apply Footer */
+ $pdf->setFooter([
+ 'odd' => $footer_content,
+ 'even' => $footer_content
+ ]);
+
+
+
+
+
+ /* (3) Page 1 - Récapitulatif
+ ---------------------------------------------------------*/
+ /* (1) Initialize page */
+ $pdf->AddPage();
+
+ /* (2) Write content */
+ $pdf->WriteHTML('
+
1. Récapitulatif
+
+
+
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. (cliquer ici) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+
+
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+
+
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. (cliquer ici) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. (cliquer ici) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+
+
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+
+
+
+ Mollitia quo ullam voluptas quia delectus nihil ab. (cliquer ici) Temporibus voluptatum et adipisci dolores aut ut. Aliquid et non quaerat ipsa accusantium quis doloribus minus. Omnis cupiditate iste id a quisquam sunt officia. Architecto ut id non et deleniti et. Veritatis in consectetur ut
+