| Current Path : /home/wirbesti/www/ |
| Current File : /home/wirbesti/www/pdffiller.php |
<?php
/* include autoloader */
$getimg = getcwd();
require_once $getimg.'/libraries/dompdf/autoload.inc.php';
/* reference the Dompdf namespace */
use Dompdf\Dompdf;
try {
$dompdf = new Dompdf();
$dompdf->set_option('enable_html5_parser', TRUE);
$image=getcwd();
$adresse= urldecode($_GET['streetno']);
$plz= urldecode($_GET['zipcode']);
$date= urldecode($_GET['date_of_birth']);
$geburtstag=substr("$date", 0, 2);
$geburtstag2=substr("$date", 3, 2);
$geburtstag3=substr("$date", 6, 4);
$stadt= urldecode($_GET['ort']);
$kanton= urldecode($_GET['canton']);
$randnum= rand();
$this->set('rand',$randnum);
$jpgform = urldecode($_GET['jpg']);
echo 'form = '.$image.'/'.$jpgform.'</br>';
$html = '<html>
<head><meta http-equiv=Content-Type content="text/html; charset=UTF-8">
<style type="text/css">
<!--
span.cls_004{font-family:Times,serif;font-size:10.1px;color:rgb(227,31,37);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_004{font-family:Times,serif;font-size:10.1px;color:rgb(227,31,37);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_005{font-family:"Verdana Bold",serif;font-size:10.1px;color:rgb(33,30,31);font-weight:bold;font-style:normal;text-decoration: none}
div.cls_005{font-family:"Verdana Bold",serif;font-size:10.1px;color:rgb(33,30,31);font-weight:bold;font-style:normal;text-decoration: none}
span.cls_006{font-family:Times,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_006{font-family:Times,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_009{font-family:Arial,serif;font-size:16.5px;color:rgb(227,31,37);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_009{font-family:Arial,serif;font-size:16.5px;color:rgb(227,31,37);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_003{font-family:Times,serif;font-size:14.1px;color:rgb(254,255,255);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_003{font-family:Times,serif;font-size:14.1px;color:rgb(254,255,255);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_007{font-family:Arial,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_007{font-family:Arial,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_008{font-family:Times,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
div.cls_008{font-family:Times,serif;font-size:10.1px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
span.cls_010{font-family:Arial,serif;font-size:13.1px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
div.cls_010{font-family:Arial,serif;font-size:13.1px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
span.cls_011{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_011{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_013{font-family:Arial,serif;font-size:3.4px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_013{font-family:Arial,serif;font-size:3.4px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_012{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:normal;font-style:italic;text-decoration: none}
div.cls_012{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:normal;font-style:italic;text-decoration: none}
span.cls_014{font-family:Arial,serif;font-size:3.4px;color:rgb(43,42,41);font-weight:normal;font-style:italic;text-decoration: none}
div.cls_014{font-family:Arial,serif;font-size:3.4px;color:rgb(43,42,41);font-weight:normal;font-style:italic;text-decoration: none}
span.cls_015{font-family:Arial,sans-serif;font-size:11px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
div.cls_015{font-family:Arial,sans-serif;font-size:11px;color:rgb(43,42,41);font-weight:normal;font-style:normal;text-decoration: none}
span.cls_016{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
div.cls_016{font-family:Arial,serif;font-size:5.6px;color:rgb(43,42,41);font-weight:bold;font-style:normal;text-decoration: none}
span.cls_017{font-family:Arial,serif;font-size:5.6px;color:rgb(254,255,255);font-weight:bold;font-style:normal;text-decoration: none}
div.cls_017{font-family:Arial,serif;font-size:5.6px;color:rgb(254,255,255);font-weight:bold;font-style:normal;text-decoration: none}
@page { margin: 0px!important;size: a4 portrait!important; }
body,html { margin: 0px!important; }
-->
</style>
</head>
<body>
<div style="position:absolute;left:0px;top:0px; right:0;bottom:0">
<img src="'.$image.'/'.$jpgform.'" style="width:100%; height:auto" ></div>
</div>
<div style="position:absolute;left:110px;top:832px" class="cls_015"><span class="cls_015">'.$kanton.'</span></div>
<div style="position:absolute;left:335px;top:832px" class="cls_015"><span class="cls_015">'.$plz.'</span></div>
<div style="position:absolute;left:210px;top:855px" class="cls_015"><span class="cls_015">'.$stadt.'</span></div>
<div style="position:absolute;left:260px;top:902px" class="cls_015"><span class="cls_015">'.$geburtstag.'</span></div>
<div style="position:absolute;left:282px;top:902px" class="cls_015"><span class="cls_015">'.$geburtstag2.'</span></div>
<div style="position:absolute;left:305px;top:902px" class="cls_015"><span class="cls_015">'.$geburtstag3.'</span></div>
<div style="position:absolute;left:342px;top:902px" class="cls_015"><span class="cls_015">'.$adresse.'</span></div>
</body>
</html>
';
$dompdf->loadHtml($html);
/* Render the HTML as PDF */
$dompdf->render();
/* Output the generated PDF to Browser */
$filename2 = $randnum.'.pdf';
$output = $dompdf->output();
file_put_contents($filename2, $output);
$hosturl = (isset($_SERVER["HTTPS"]) ? "https://" : "http://") . $_SERVER["HTTP_HOST"];
$this->set('prefillpdf',$hosturl.'/'.$filename2);
//header('Location: '.$hosturl.'/'.$filename2);
print('Location: '.$hosturl.'/'.$filename2);
} catch(\Exception $e) { echo "<pre>" . print_r($e, true); }
?>