diff options
| author | polo <ordipolo@gmx.fr> | 2022-12-02 15:29:02 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2022-12-02 15:29:02 +0100 |
| commit | 6b55446d12a5c39d5a4a4584bfabc7507c2f9b74 (patch) | |
| tree | 8e2e337b93391225d5e702a553314164f6139d86 /php/latexToPdf.php | |
| parent | 473ee4ec50a6bfdfa5c145471b077b7e3749beeb (diff) | |
| download | AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.tar.gz AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.tar.bz2 AppliGestionPHP-6b55446d12a5c39d5a4a4584bfabc7507c2f9b74.zip | |
date<->timestamp, ===, renommage, latex
Diffstat (limited to 'php/latexToPdf.php')
| -rw-r--r-- | php/latexToPdf.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/php/latexToPdf.php b/php/latexToPdf.php new file mode 100644 index 0000000..18ff452 --- /dev/null +++ b/php/latexToPdf.php | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | <?php | ||
| 2 | // php/latexToPdf.php | ||
| 3 | |||
| 4 | // contenu | ||
| 5 | $latex = '\documentclass{article} | ||
| 6 | |||
| 7 | \usepackage[french]{babel} | ||
| 8 | \usepackage[utf8]{inputenc} | ||
| 9 | \usepackage[T1]{fontenc} | ||
| 10 | |||
| 11 | \begin{document} | ||
| 12 | Bravo, ça compile !! | ||
| 13 | \end{document}'; | ||
| 14 | |||
| 15 | $fileName = 'latex.tex'; | ||
| 16 | $latexPath = ''; | ||
| 17 | $pdfPath = ''; | ||
| 18 | |||
| 19 | //~ writeLatex($latex, $fileName, $latexPath); | ||
| 20 | |||
| 21 | function latexToPdf(string $fileName, string $latexPath, string $pdfPath) | ||
| 22 | { | ||
| 23 | $outputDir = ''; | ||
| 24 | if($pdfPath !== '') | ||
| 25 | { | ||
| 26 | $outputDir = '-output-directory=' . $pdfPath . ' '; | ||
| 27 | } | ||
| 28 | |||
| 29 | // compilation | ||
| 30 | exec('pdflatex ' . $outputDir . $latexPath . $fileName); | ||
| 31 | |||
| 32 | // nettoyage | ||
| 33 | $basename = basename($fileName, '.tex'); | ||
| 34 | unlink($pdfPath . $basename . '.aux'); | ||
| 35 | unlink($pdfPath . $basename . '.log'); | ||
| 36 | } | ||
| 37 | |||
| 38 | //~ latexToPdf($fileName, $latexPath, $pdfPath); | ||
