Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Grubość ramki w pdf'ach
sazian
post 30.11.2014, 21:01:59
Post #1





Grupa: Zarejestrowani
Postów: 1 045
Pomógł: 141
Dołączył: 19.09.2006
Skąd: B-tów

Ostrzeżenie: (0%)
-----


Witam,
mam problem z grubością ramek w pdf'ach generowanych w php.
Obecnie używam biblioteki TCPDF ale nie wykluczam zmiany jeśli w innej da się to rozwiązać.

Mój problem polega na tym że ramka generowana przez metodę Cell jest znacznie cieńsza(i taki efekt potrzebuję) niż ta generowane przez writeHTML.
Przykładowy kod dla Cell
  1. $pdf = new TCPDF();
  2. $pdf->SetAutoPageBreak(true);
  3. $pdf->SetMargins(3, 5, -1);
  4. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  5. $pdf->SetFooterMargin(25);
  6. $pdf->SetFont('dejavusans', '', 10);
  7. $pdf->setPrintHeader(false);
  8. $pdf->setPrintFooter(TRUE);
  9. $pdf->SetAutoPageBreak(True, 25);
  10. $pdf->AddPage();
  11. $pdf->Cell(95,5,'aaa',1,0);
  12. $pdf->Output( '1.pdf', 'D');

i dla writeHTML
  1. $pdf = new TCPDF();
  2. $pdf->SetAutoPageBreak(true);
  3. $pdf->SetMargins(3, 5, -1);
  4. $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
  5. $pdf->SetFooterMargin(25);
  6. $pdf->SetFont('dejavusans', '', 10);
  7. $pdf->setPrintHeader(false);
  8. $pdf->setPrintFooter(TRUE);
  9. $pdf->SetAutoPageBreak(True, 25);
  10. $pdf->AddPage();
  11.  
  12. $pdf->writeHTML('<!DOCTYPE html>
  13. <html>
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  16. <style type="text/css">
  17. *
  18. {
  19. font-size:7px;
  20. margin:0;
  21. padding: 0;
  22. text-align: left;
  23. }
  24. td
  25. {
  26. border:1px solid #000;
  27.  
  28.  
  29. }
  30. table
  31. {
  32. border-collapse: collapse;
  33. }
  34.  
  35. </style>
  36. </head>
  37. <body>
  38. <table>
  39. <tr>
  40. <td>aaa</td>
  41. </tr>
  42. </table>
  43. </body>
  44. <html>');
  45. $pdf->Output( '2.pdf', 'D');

w teorii w obu przypadkach ramka ma mieć 1px, ale ta html'owa jest wyraźnie grubsza.
czy ktoś może wie w czym jest problem ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 26.06.2025 - 00:18