Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function get_PDF($user_id, $qr_url, $datos){
- require_once('library/tcpdf/tcpdf.php');
- $size = array(216,279);
- $pdf = new TCPDF('L', PDF_UNIT, $size, true, 'UTF-8', false);
- $pdf->setPrintHeader(false);
- $pdf->setPrintFooter(false);
- $pdf->SetAutoPageBreak(TRUE, 0);
- $pdf->AddPage();
- $datoshtml = '<h4> ' . substr($datos['nombres'], 0, 1)
- . substr($datos['appellido1'], 0, 1)
- . substr($datos['appellido2'], 0, 1)
- . '</h4><h4> '
- . $datos['escuela']
- . '</h4><h4> '
- . $datos['grado_escolar']
- . '</h4>';
- $html = '
- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
- <table width="610">
- <tr>
- <td>
- </td>
- <td>
- </td>
- <td width="310" style="border: 1px solid #000;">
- <table>
- <tr>
- <td>
- </td>
- <td colspan="2">
- ' . $datoshtml . '
- </td>
- </tr>
- <tr><td></td><td></td><td></td></tr>
- </table>
- </td>
- </tr>
- </table>
- ';
- $pdf->writeHTML($html, true, false, true, false, '');
- $pdf->setJPEGQuality(40);
- $pdf->Image($qr_url, 156, 164, 35, 35, 'PNG');
- $dir = wp_upload_dir();
- $outfile = $dir['basedir'] . '/users-files/pdf_'. $user_id . '.pdf';
- $pdf->Output($outfile, 'F');
- return $outfile;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement