function wpcf7_do_something_else($wpcf7_data) { include_once getcwd() . '/pdf/phpToPDF.php'; $datos = get_object_vars($wpcf7_data); $datos = $datos['posted_data']; $html = file_get_contents(getcwd() . '/pdf/formato_carta.html'); $isapre = $datos['isapre']; $nombre_completo = $datos['nombre_completo']; $rut = $datos['rut']; $precio_base_actual = $datos['precio_base_actual']; $precio_base_adecuado = $datos['precio_base_adecuado']; $nombre_plan = $datos['nombre_plan']; $precio_final_actual = $datos['precio_final_actual']; $fecha_emision = $datos['fecha_emision_carta']; $fecha_entrega = $datos['fecha_entrega_carta']; $precio_final_adecuado = $datos['precio_final_adecuado']; $html = str_replace("{{ISAPRE}}", $isapre, $html); $html = str_replace("{{NOMBRE_COMPLETO}}", $nombre_completo, $html); $html = str_replace("{{RUT}}", $rut, $html); $html = str_replace("{{PRECIO_BASE_ACTUAL}}", $precio_base_actual, $html); $html = str_replace("{{PRECIO_BASE_ADECUADO}}", $precio_base_adecuado, $html); $html = str_replace("{{NOMBRE_PLAN}}", $nombre_plan, $html); $html = str_replace("{{PRECIO_FINAL_ACTUAL}}", $precio_final_actual, $html); $html = str_replace("{{FECHA_EMISION}}", $fecha_emision, $html); $html = str_replace("{{FECHA_DE_ENTREGA}}", $fecha_entrega, $html); $html = str_replace("{{PRECIO_FINAL_ADECUADO}}", $precio_final_adecuado, $html); //echo $html; die(); $path = '/pdf/pdf/'; $filename = rand(1, 999999999) . '.pdf'; phptopdf_html($html, $path, $filename); $wpcf7_data->uploaded_files['pdf_datos'] = $path . $filename; }
Payment Type: MasterCard </p> <hr> <table> <tr><td><strong>Description</strong></td><td><strong>Qty</strong></td><td><strong>Unit Price</strong></td><td><strong>Amount</strong></td></tr> <tr class="odd"><td>Product 1</td><td>1</td><td>4.95</td><td>4.95</td></tr><tr class="even"><td>Product 2</td><td>1</td><td>4.95</td><td>4.95</td></tr><tr class="odd"><td>Product 3</td><td>1</td><td>4.95</td><td>4.95</td></tr> <tr><td> </td><td> </td><td><strong>Total</strong></td><td><strong>14.85</strong></td></tr> </table> <hr> <p> Thank you for your order! This transaction will appear on your billing statement as "Your Company".<br /> If you have any questions, please feel free to contact us at <a href="mailto:youremail@somewhere.com">youremail@somewhere.com</a>. </p> <hr> <p> <center><small>This communication is for the exclusive use of the addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient any use, copying, disclosure, dissemination or distribution is strictly prohibited. <br /><br /> © Your Company All Rights Reserved </small></center> </p> </div><!--end content--> </div><!--end page--> </body> </html>'; phptopdf_html ( $html, 'pdf/', 'my_pdf_filename.pdf' ); echo "<a href='pdf/my_pdf_filename.pdf'>Download PDF</a>"; ?>
<?php // INCLUDE THE phpToPDF.php FILE require "phpToPDF.php"; // GENERATE PDF FILE FROM SPECIFIED URL, SAVES TO CURRENT DIRECTORY ('') phptopdf_html('<html>Hello World!<br><br>HTML Test using phpToPDF</html>', '', 'legacy_html_example.pdf'); // OPTIONAL - PUT A LINK TO DOWNLOAD THE PDF YOU JUST CREATED echo "<a href='legacy_html_example.pdf'>Download Your PDF</a>"; ?>
<?php require_once "../initialize.php"; if (isset($_POST['thehtml']) && $_POST['thehtml'] != '' && isset($_POST['path']) && $_POST['path'] != '') { //if(file_exists('../../'.$_POST['path'].'Yearbook.pdf')) //{ //unlink('../../'.$_POST['path'].'Yearbook.pdf'); //} phptopdf_html($_POST['thehtml'], '../../' . $_POST['path'], 'Yearbook.pdf'); echo "<a href='" . $_POST['path'] . "Yearbook.pdf' download='" . $_POST['path'] . "Yearbook.pdf'>Download</a>"; echo " or <a href='" . $_POST['path'] . "Yearbook.pdf'>View</a> PDF'd Yearbook"; } else { echo "error"; }