Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
- // set header and footer fonts
- //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
- //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
- // set default monospaced font
- $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
- // set margins
- $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
- $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
- $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
- // 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);
- }
- //$pdf->PDF_PAGE_ORIENTATION('L');
- $pdf->AddPage('L', array(210, 330));
- $pdf->SetTitle('ID Siswa');
- $pdf->SetHeaderMargin(false);
- $pdf->SetTopMargin(20);
- $pdf->setFooterMargin(20);
- $pdf->setJPEGQuality(75);
- $pdf->SetAutoPageBreak(true);
- $pdf->SetAuthor('Author');
- $pdf->SetDisplayMode('real', 'default');
- //$i=0;
- $html='<h3>ID SISWA</h3>
- <table cellspacing="1" bgcolor="#666666" cellpadding="2">
- <tr width="20%" bgcolor="#ffffff" >
- <th width="18%" align="center">id</th>
- <th width="18%" align="center">nisn</th>
- <th width="9%" align="center">NAMA</th>
- <th width="7%" align="center">JENIS KELAMIN</th>
- <th width="7%" align="center">KELAS</th>
- <th width="9%" align="center">TEMPAT LAHIR</th>
- <th width="8%" align="center">TANGGAL LAHIR</th>
- <th width="8%" align="center">QR CODE</th>
- </tr>';
- //<img src="tcpdf/examples/images/tiger.ai" alt="test alt attribute" width="100" height="100" border="0" />
- echo print_r($siswa);
- var_dump($siswa);
- foreach ($siswa as $sw => $a)
- {
- //$i++;
- $html.="<tr bgcolor='#ffffff'>
- <td>".$a['id_siswa']."</td>
- <td>".$a['nisn']."</td>
- <td>".$a['nama']."</td>
- <td>".$a['jk']."</td>
- <td>".$a['kelas']."</td>
- <td>".$a['tempat_lahir']."</td>
- <td>".$a['tanggal_lahir']."</td>
- <td><img src='assets/images/".$a['qr_code']."/></td>
- </tr>";
- }
- $html.='</table>';
- //$pdf->lastPage();
- $pdf->writeHTML($html, true, false, true, false, '');
- $pdf->Output('daftar_siswa.pdf', 'I');
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement