Example #1
0
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                            </td>
                        </tr>    
                    </tbody>    
                </table>
                <div class="row" style="text-align: right;">
                    <label id="hStory" style="text-align: right">สอบถามรายละเอียดเพิ่มเติมได้ที่  40147 (ชลวภรณ์)</label>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

<?php 
$html = ob_get_contents();
ob_end_clean();
$stylesheet = file_get_contents('assets/css/print.css');
// external css
$pdf = new mPDF('th', 'A4', '0', 'thsarabunnew', 20, 15, 5, 30);
$pdf->SetAutoFont(AUTOFONT_THAIVIET);
$pdf->SetDisplayMode('fullpage');
$pdf->WriteHTML($stylesheet, 1);
$pdf->WriteHtml($html, 2);
$pdf->Output();
Example #2
0
if (isset($_SESSION["last_activity"]) && $_SESSION["last_activity"] + $_SESSION["time_out"] * 60 < time()) {
    session_unset();
    session_destroy();
    header("Location: login.php");
    exit;
}
$_SESSION["last_activity"] = time();
if (isset($_POST["expected_sales"])) {
    VariablesTable::update_expected_sales($_POST["expected_sales"]);
}
if (isset($_POST["table_data"])) {
    $mpdf = new mPDF("", "A4", 0, 'roboto', 0, 0, 0, 0, 0, 0);
    $stylesheet = file_get_contents("styles.css");
    $mpdf->useSubstitutions = false;
    $mpdf->simpleTables = true;
    $mpdf->WriteHtml($stylesheet, 1);
    $mpdf->WriteHtml($_POST["table_data"], 2);
    $mpdf->Output($_POST["table_name"] . " - " . $_POST["table_date"] . ".pdf", "D");
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Print Preview</title>
    <link href='https://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <div class="toolbar_print">