Using Tcpdf To Convert Specific Div To Pdf
I have a web application written in javascript. At the end of the application, the user is presented with a receipt that shows all their actions during the course of their operatin
Solution 1:
You could use PHP: DOM to search through the HTML file and find the contents of the DIV, and then convert what it finds into a PDF.
Solution 2:
- Add a 'print' button at the bottom of the receipt.
- Add a javascript function at the 'onclick' event of the print button. Get the content of the receipt div ( using jquery: $('#receipt').html() or javascript 'document.getEmementById('receipt').innerHTML'). Add this content to a hidden variable in a form. Submit the form to a dedicated php file. (<form target='_blank')
You got the the post data in the dedicated php file.
$html = $_POST['hiddenHtml'];
- $pdf->writeHTML($html, true, false, true, false, '');
Post a Comment for "Using Tcpdf To Convert Specific Div To Pdf"