Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. $('.form_calc .btn_wrap .btn-download').click(function(){
  2. //Скачать предложение
  3. var path = '/pdf/pdf.php';
  4. var formData = $("#form").serialize();
  5. formData += "&action=download";
  6. var success = function( response ){
  7. if (response.status == "OK") {
  8.  
  9. /*if (typeof (window.open) == "function") {
  10. window.open(response.message);
  11. }
  12. else {
  13. window.location.href = response.message;
  14. }*/
  15. //alert (response.message;);
  16. window.location.href = response.message;
  17. }
  18. else {
  19. alert (response.message);
  20. }
  21. }
  22. $.post(path, formData, success, "json");
  23.  
  24. return false;
  25.  
  26. });
  27.  
  28. <?php
  29.  
  30. require_once('../dompdf/autoload.inc.php');
  31.  
  32. use DompdfDompdf;
  33.  
  34. // instantiate and use the dompdf class
  35. $dompdf = new Dompdf();
  36. $html = '../index1.html';
  37. $content = file_get_contents($html);
  38. $dompdf->loadHtml($content);
  39.  
  40. // (Optional) Setup the paper size and orientation
  41. $dompdf->setPaper('A4', 'landscape');
  42.  
  43. // Render the HTML as PDF
  44. $dompdf->render();
  45.  
  46. // Output the generated PDF to Browser
  47. $dompdf->stream();
  48.  
  49. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement