Beispiel #1
0
<html>
<head>
<style>
BODY { font-family: Tahoma; font-size: 10pt }
</style>
</head>
<body>
PD4ML HTML conversion demo: embed TTFs and write PDF to a file (with debug=on)<p>
<pre>
<?php 
$evaluation = 1;
$java = "java";
$url = getUrlBase() . "xdemocjk.php";
$fontsdir = "../fonts/";
if ($evaluation == 1) {
    $jar = "../pd4ml_demo.jar";
} else {
    $jar = "../pd4ml.jar";
}
$pdfname = uniquename();
echo "file: {$pdfname}<p>";
if (strpos(php_uname(), 'Windows') !== FALSE) {
    // server platform: Windows
    $fontsdir = preg_replace('/\\//', "\\", $fontsdir);
    $jar = preg_replace('/\\//', "\\", $jar);
    $cmdline = "{$java} -Xmx512m -cp {$jar} Pd4Cmd \"{$url}\" 800 A4 -debug -ttf {$fontsdir} -out {$pdfname}";
} else {
    // server platform: UNIX-derived
    $cmdline = "{$java} -Xmx512m -Djava.awt.headless=true -cp {$jar} Pd4Cmd \"{$url}\" 800 A4 -debug -ttf {$fontsdir} -out {$pdfname} 2>&1";
}
if (!file_exists($fontsdir . "pd4fonts.properties")) {
Beispiel #2
0
<?php

$evaluation = 1;
$java = "java";
$url = getUrlBase() . "xdemo.php";
if ($evaluation == 1) {
    $jar = "../pd4ml_demo.jar";
} else {
    $jar = "../pd4ml.jar";
}
header("Pragma: cache");
header("Expires: 0");
header("Cache-control: private");
header('Content-type: application/pdf');
header('Content-disposition: attachment; filename=pdftest.pdf');
if (strpos(php_uname(), 'Windows') !== FALSE) {
    // server platform: Windows
    $jar = preg_replace('/\\//', "\\", $jar);
    $cmdline = "{$java} -Xmx512m -cp {$jar} Pd4Cmd \"{$url}\" 800 A4";
} else {
    // server platform: UNIX-derived
    $cmdline = "{$java} -Xmx512m -Djava.awt.headless=true -cp {$jar} Pd4Cmd \"{$url}\" 800 A4";
}
// see for more command-line parameters: http://pd4ml.com/html-to-pdf-command-line-tool.htm
passthru($cmdline);
function getUrlBase()
{
    $http = 'http';
    if ($_SERVER["HTTPS"] == "on") {
        $http .= "s";
    }
Beispiel #3
0
 /**
  * @param User $user
  * @return boolean
  */
 public function sendEmailVerification(User $user)
 {
     $code = md5(rand(1, 10000) * time());
     $user->setEmailVerifyCode($code);
     $user->setEmailConfirmed(false);
     $user->commitChanges();
     $url = getUrlBase();
     $verifyUrl = $url . "/index.php?module=register&action=verifymail&k=" . $code;
     $message = sprintf("Hello %s\n\nYou, or someone has created an account on %s with this e-mail address.\n\nTo verify your account please open the web address under (or click it)\n%s\n\nSent by LANCMS to %s because the user %s was created on the site %s at %s.", $user->getFullName(), $url, $verifyUrl, $user->getEmail(), $user->getNick(), $url, date("d.m.Y H:i:s", $user->getRegisterTime()));
     mail($user->getEmail(), "Verify your user account", $message);
     return true;
 }