Sempervivum
Erfahrenes Mitglied
Poste einfach den Text in Codetags. Du kannst ihn ja abkürzen, einige Einträge reichen aus.
Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
$preisschild_code = '329776';
$sql = "SELECT * FROM preisschild WHERE preisschild_code = $preisschild_code";
$schild = $pdo->query($sql)->fetch();
//////////////////////////// Erzeugung eures PDF Dokuments \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// TCPDF Library laden
require_once('tcpdf/tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$img_file = K_PATH_IMAGES.'../Vorlagen/DINA4_nimm-mich-mit.jpg';
$this->Image($img_file, 0, 0, 594, 841, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$this->setPageMark();
}
}
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 051');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// remove default footer
$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 48);
// add a page
$pdf->AddPage();
// --- example with background set on page ---
// remove default header
$pdf->setPrintHeader(false);
// Print a text
$html = '
<span style="margin:850px; font-size:170px; font-weight:700;">
'.$schild['artikel_bezeichnung'].'
</span>
';
$pdf->writeHTML($html, true, false, true, false, '');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_051.pdf', 'I');
class MYPDF extends TCPDF {
//Page header
public function Header() {
global $schild;
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$img_file = K_PATH_IMAGES.'Vorlagen/'.$schild['vorlage'].'.jpg';
$this->Image($img_file, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$this->setPageMark();
}
}
<div style="display:(($schild[ratenkauf_laufzeit] == 18) ? 'block' : 'none');">
$rate2
</div>
<div style="display:none;">
$rate2
</div>
<div style="display:<?php echo (($schild['ratenkauf_laufzeit'] == 18) ? 'block' : 'none'); ?>">
$rate2
</div>
$preisschild_code = $_POST[preisschild_code];
$sql = "SELECT * FROM preisschild WHERE preisschild_code = $preisschild_code";
$schild = $pdo->query($sql)->fetch();
// Include the main TCPDF library (search for installation path).
require_once('tcpdf/tcpdf.php');
// Extend the TCPDF class to create custom Header and Footer
class MYPDF extends TCPDF {
//Page header
public function Header() {
global $schild;
// get the current page break margin
$bMargin = $this->getBreakMargin();
// get current auto-page-break mode
$auto_page_break = $this->AutoPageBreak;
// disable auto-page-break
$this->SetAutoPageBreak(false, 0);
// set bacground image
$img_file = K_PATH_IMAGES.'Vorlagen/'.$schild['vorlage'].'.jpg';
$this->Image($img_file, 0, 0, 594, 841, '', '', '', false, 300, '', false, false, 0);
// restore auto-page-break status
$this->SetAutoPageBreak($auto_page_break, $bMargin);
// set the starting point for the page content
$this->setPageMark();
}
}
$betrag2 = $schild['preis_neu']/12;
$rate2 = round($betrag2, 2) ;
$zahl1 = $schild['preis_alt'];
$alt_preis = number_format($zahl1, 0, ',', '.');
$zahl2 = $schild['preis_neu'];
$endbetrag = number_format($zahl2, 0, ',', '.');
// create new PDF document
$pdf = new MYPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 051');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
// remove default footer
$pdf->setPrintFooter(false);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
// set font
$pdf->SetFont('times', '', 10);
// add a page
$pdf->AddPage();
// Print a text
$html =
<<<EOF
<!-- EXAMPLE OF CSS STYLE -->
<style>
td {font-size: 10px;font-family: "Gill Sans", "Gill Sans MT", "Myriad Pro", "DejaVu Sans Condensed", Helvetica, Arial, "sans-serif"}
.td_kopf {font-size:850px;}
.artikel_nr {font-size:40px; text-align:left;}
.artikel_bezeichnung {font-size:120px;}
.artikel_zusatz {font-size:60px;}
.masse {font-size:40px;}
.alter_preis {font-size:60px;}
.abstand_preis_neu {font-size:120px;}
.preis_neu {font-size:360px;}
.abstand_info {font-size:40px;}
.info {font-size:40px;}
.ratenkauf_laufzeit { color:red; }
.abstand_preisschild_code {font-size:140px;}
.preisschild_code {font-size:20px;}
</style>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="11" class="td_kopf"> </td>
</tr>
<tr>
<td width="2%" class="artikel_nr">#</td>
<td width="35%" class="artikel_nr">$schild[artikel_nr]</td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
<td width="7%"> </td>
</tr>
<tr>
<td colspan="11"></td>
</tr>
<tr>
<td colspan="11"></td>
</tr>
<tr>
<td colspan="11" class="artikel_bezeichnung"><strong>$schild[artikel_bezeichnung]</strong></td>
</tr>
<tr>
<td colspan="11" class="artikel_zusatz">$schild[artikel_zusatz]</td>
</tr>
<tr>
<td colspan="6" class="masse">$schild[masse]</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"> </td>
<td> </td>
<td> </td>
<td> </td>
<td colspan="5" align="center" class="alter_preis"><br /><strong>Normalpreis:<br />$alt_preis,-</strong></td>
<td> </td>
</tr>
<tr>
<td colspan="11" class="abstand_preis_neu"> </td>
</tr>
<tr>
<td colspan="11" class="preis_neu" align="center"><strong>
$endbetrag,-
</strong></td>
</tr>
<tr>
<td colspan="11" class="abstand_info"></td>
</tr>
<tr>
<td colspan="11" class="info">$schild[info]</td>
</tr>
<tr>
<td colspan="11">
<div style="display:(($schild[ratenkauf] == 0 ) ? 'block' : 'none')">
<img src="Vorlagen/ratenlogo1.png" width="450" ><br />
<span style="font-size:50px; color:#ee1921" align="left" class="rate2"> <strong>ab $rate2 Euro</strong></span>
</div>
</td>
</tr>
<tr>
<td colspan="11" class="abstand_preisschild_code"></td>
</tr>
<tr>
<td colspan="11" Class="preisschild_code">ps: $schild[preisschild_code]</td>
</tr>
</tbody>
</table>
EOF;
$pdf->writeHTML($html, true, false, true, false, '');
//Close and output PDF document
$pdf->Output('example_051.pdf', 'I');
?>