示例#1
0
<?php

define("BASE_DIR", dirname(dirname(__FILE__)));
require_once BASE_DIR . "/include/constants.inc";
require_once BASE_DIR . "/include/globals.inc";
require_once BASE_DIR . "/include/misc.inc";
require_once BASE_DIR . "/include/print.inc";
require_once BASE_DIR . "/include/layout.inc";
require_once BASE_DIR . '/_ext/html2pdf_v4.03/html2pdf.class.php';
$g_i18n = new I18n();
$g_i18n->init();
ob_start();
layout_i18n(BASE_DIR . '/test/bill2pdf_content.php');
$content = ob_get_clean();
try {
    $html2pdf = new HTML2PDF('P', 'A4', 'fr');
    //      $html2pdf->setModeDebug();
    $html2pdf->setDefaultFont('Arial');
    $html2pdf->writeHTML($content, false);
    $html2pdf->Output(BASE_DIR . '/test/pdf/test.pdf');
} catch (HTML2PDF_exception $e) {
    echo $e;
    exit;
}
示例#2
0
} catch (Exception $e) {
    $_SESSION["state"] = "error";
    message_set_error($e->getMessage());
    debug(sprint_r($e->getTrace()));
}
if (!in_array($_SESSION["state"], $g_states)) {
    message_set_error("Undeclared state: " . $_SESSION["state"] . ".");
    $_SESSION["state"] = "error";
}
debug("SESSION['state']=" . $_SESSION["state"]);
debug("g_page=" . $g_page);
if ($_SESSION["state"] == "not_allowed") {
    $g_page = "error";
}
if (!is_null_or_empty($g_page)) {
    $g_state = $g_page;
    $g_page = SKIN_DIR . "/" . $g_page . ".php";
} else {
    $g_state = $_SESSION["state"];
    $g_page = SKIN_DIR . "/" . $_SESSION["state"] . ".php";
}
if (!file_exists($g_page)) {
    $g_page = SKIN_DIR . "/error.php";
    message_set_error(_t("Page not existing."));
}
debug("Session after: " . $_SESSION["state"]);
//message_set_info("This is an info message.");
//message_set_error("This is an error message.");
message_process();
layout_i18n(SKIN_DIR . "/layout.php");