Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [PHP] tworzenie pliku pdf z wygenerowanego dla przeglądarki kodu html
Forum PHP.pl > Forum > PHP
kanjox
Jak w temacie. mam taką podstronę w której wczytuję dane z bazy do tabel:
  1. <?php
  2. require_once('connect/connect.php');
  3.  
  4. $mysql=$con->query("SELECT * FROM przyjecie_towar");
  5. echo<<<label
  6. <center>
  7.  
  8. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  9. <td width="45%">
  10. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  11. <td align="center" valign="bottom" >(pieczęć)</td>
  12. <td align="center" valign="bottom">(dostawca)</td>
  13. </table>
  14. </td>
  15. <td>
  16. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  17. <td style="background-color:silver">
  18. <table cellspacing="0" width="100%" height="100%">
  19. <tr ><th align="center" valign="bottom" > PZ </th></tr>
  20. <tr><td align="center" valign="bottom">przyjęcie </td></tr>
  21. <td align="center" valign="center">zewnętrzne</td>
  22. </td>
  23. </table>
  24. </table>
  25. </td>
  26. <td>
  27. <table cellspacing="0" border=1 bordercolor="black"width="100%" height="100%">
  28. <tr><th style="background-color:silver">Nr bieżący</th>
  29. <th style="background-color:silver">Egz.</th></tr>
  30. <td> </td>
  31. <td> </td>
  32. <tr><th style="background-color:silver">Nr magazynowy</th>
  33. <th style="background-color:silver">Data wystawienia</th></tr>
  34. <td> </td>
  35. <td> </td>
  36. </table>
  37. </td>
  38. <tr>
  39. <td colspan="3" style="padding: 0 px">
  40. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  41. <tr style="background-color:silver"><th>Zamówienie</th>
  42. <th>Data zamówienia</th>
  43. <th>Data wysyłki</th>
  44. <th>Data otrzymania</th>
  45. <th>Numer faktury</th></tr>
  46. <td><center> </center></td>
  47. <td><center> </center></td>
  48. <td><center> </center></td>
  49. <td><center> </center></td>
  50. <td><center> </center></td>
  51. </table>
  52. </td>
  53. </tr>
  54.  
  55. <tr>
  56. <td colspan="3" style="padding: 0 px">
  57. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  58. <tr style="background-color:silver"><th width="3%">L.p.</th>
  59. <th width="10%">ID</th>
  60. <th width="20%">Nazwa</th>
  61. <th>Cena jedn.</th>
  62. <th><table cellspacing="0" border=1 bordercolor="black" frame="void" width="100%" height="100%">
  63. <tr><th colspan="3">Ilość</th></tr>
  64. <th width="33%">Otrzymane</th><th width="33%">Zamówione</th><th width="33%">Przyjęte</th>
  65. </table>
  66. </th>
  67. <th width="15%">Wartość przyjętego towaru(zł)</th>
  68. <th>Zapas</th>
  69. </tr>
  70. label;
  71.  
  72. while ($r = mysqli_fetch_assoc($mysql))
  73. {
  74.  
  75. echo '<tr>';
  76. echo '<td><center>'.$r['id_p'].'</center></td>';
  77. echo '<td><center>'.$r['id_t'].'</center></td>';
  78. echo '<td><center>'.$r['name'].'</center></td>';
  79. echo '<td><center>'.$r['price'].'</center></td>';
  80. echo '<td cellpading="0"><table cellspacing="0" border=1 bordercolor="black" frame="void" width="100%" height="100%">
  81. <td width="33%"><center>'.$r['ot'].'</center></td><td width="33%"><center>'.$r['zam'].'</center></td><td width="33%"><center>'.$r['nastan'].'</center></td>
  82. </table></td>';
  83. echo '<td><center>'.$r['price'].'</center></td>';
  84. echo '<td><center>'.$r['zapas'].'</center></td>';
  85. }
  86.  
  87.  
  88. echo<<<label
  89. </table>
  90. </tr>
  91. <tr>
  92. <td colspan="3" style="padding: 0 px">
  93. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  94. <th style="background-color:silver">Wymienione:</th>
  95. </table>
  96. </td>
  97. </tr>
  98. <tr>
  99. <td colspan="3" style="padding: 0 px">
  100. <table cellspacing="0" border=1 bordercolor="black" width="100%" height="100%">
  101. <tr style="background-color:silver"><th>Dostarczył</th>
  102. <th>Data</th>
  103. <th>Przyjął</th>
  104. <th>Ewidencja ilościowo-wartościowa</th>
  105. </tr>
  106. <tr>
  107. <td><center> </center></td>
  108. <td><center> </center></td>
  109. <td><center> </center></td>
  110. <td><center> </center></td>
  111. </table>
  112. </tr>
  113. </td>
  114. </tr>
  115. </table>
  116. label;
  117. ?>

i chcę ją zapisać do pliku pdf to, co dostaje przeglądarka.
Próbowałem już to zrobić za pomocą dompdf, ale "wypluwa" plik .pdf, którego nie da się otworzyć.



nospor
mpdf - mi jakos dziala
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.