Rev 3560 | Rev 5160 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?php
/**
* Template für den PDF Gutschein
*/
require_once WPSG_PATH_LIB.'fpdf/fpdf.php';
require_once WPSG_PATH_LIB.'fpdf/fpdi.php';
require_once WPSG_PATH_LIB.'wpsg_fpdf.class.php';
if ($this->get_option('wpsg_voucherproduct_width') > $this->get_option('wpsg_voucherproduct_height'))
{
$pageMode = 'L';
}
else
{
$pageMode = 'P';
}
$pdf = new wpsg_fpdf($pageMode, 'mm', array($this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height')));
$pdf->SetAutoPageBreak(true, 5);
$pdf->AddPage();
foreach ($this->view['texte'] as $t)
{
if ($t['bg'] == '1' && $t['aktiv'] == '1')
{
$t['text'] = $this->replaceUniversalPlatzhalter($t['text'], $this->view['order_id'], false, false, $this->view['product_id'], $this->view['customReplace']);
if ($t['alpha'] > 0) $pdf->setAlpha($t['alpha']);
list($r, $g, $b) = wpsg_getColor($t["color"]);
$pdf->SetTextColor($r, $g, $b);
$pdf->SetFont('Arial', '', $t['fontsize']);
$pdf->RotatedText(
$t['x'], $t['y'],
$t['text'],
$t['angle'],
$t['align']
);
$pdf->setAlpha(1);
}
}
if (isset($this->view['bp_pdf']) && file_exists($this->view['bp_pdf']))
{
$pagecount = $pdf->setSourceFile($this->view['bp_pdf']);
$tplidx = $pdf->importPage(1, '/MediaBox');
$pdf->useTemplate($tplidx, 0, 0, $this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height'));
}
else if (isset($this->view['bp_jpg']) && file_exists($this->view['bp_jpg']))
{
$pdf->image($this->view['bp_jpg'], 0, 0, $this->get_option('wpsg_voucherproduct_width'), $this->get_option('wpsg_voucherproduct_height'), 'jpg');
}
foreach ($this->view['texte'] as $t)
{
if ($t['aktiv'] == '1')
{
$t['text'] = $this->replaceUniversalPlatzhalter($t['text'], $this->view['order_id'], false, false, $this->view['product_id'], $this->view['customReplace']);
if ($t['alpha'] > 0) $pdf->setAlpha($t['alpha']);
$pdf->SetFont('Arial', '', $t['fontsize']);
$pdf->SetTextColor($t["color"]);
$pdf->RotatedText(
$t['x'], $t['y'],
$t['text'],
$t['angle'],
$t['align']
);
$pdf->setAlpha(1);
}
}
if ($this->view['preview'] !== true)
{
$pdf->Output($this->view['filename'], 'F');
}
else
{
$pdf->Output($this->view['filename'], 'I');
die();
}
?>