1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| <?php // -------------------------
/**
* HTML2PDF Library
*
* HTML => PDF convertor
* distributed under the LGPL License
*
* @package Html2pdf
* @author Laurent MINGUET <webmaster@html2pdf.fr>
* @copyright 2016 Laurent MINGUET
*
* isset($_GET['vuehtml']) is not mandatory : it allow to display the result in the HTML format
*/
// -------------------------
// get the HTML
ob_start();
// -------------------------
// CONTENU du PDF
?>
<page backcolor="#fff" footer="page" style="font-size:9pt;">
<bookmark title="Lettre" level="0" ></bookmark>
<page_header>
<?php // entête
require(__DIR__.'/order-pdf-BoxHeader.php');
?>
</page_header>
<page_footer>
<?php // pied de page
require(__DIR__.'/order-pdf-BoxFooter.php');
?>
</page_footer>
<?php // contenu
require(__DIR__.'/order-pdf-BoxVendeurAcheteur.php');
require(__DIR__.'/order-pdf-BoxTarifs.php');
require(__DIR__.'/order-pdf-BoxBanque.php');
?>
</page>
<?php
$content = ob_get_clean();
// print_r($content); // pour TEST !
// exit;
// -------------------------
// inclusion de la librairie html2pdf
require_once(dirname(dirname(dirname(__DIR__))).'/utilitaires/html2pdf/vendor/autoload.php'); // A ADAPTER !!
// convert to PDF
try
{
$html2pdf = new HTML2PDF('P', 'A4', 'fr');
$html2pdf->pdf->SetDisplayMode('fullpage');
$html2pdf->setDefaultFont('Arial');
// $html2pdf->pdf->SetProtection(array('print'), 'spipu');
$html2pdf->writeHTML($content, isset($_GET['vuehtml']));
// $html2pdf->Output($CommandePDFPathFull); // affichage à l'écran
$html2pdf->pdf->Output($CommandePDFPathFull,'F'); // enregistrement dans un fichier
}
catch(HTML2PDF_exception $e) {
echo $e;
exit;
}
// ------------------------- |
Partager