Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> html to jpg lub html to pdf
matx132
post
Post #1





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


Witam,
otóż mam taki problem iż nie wiem czy istnieje (jeśli tak to jak to zrobić) aby zapisać w PHP html do jpg lub html do pdf próbowałem bawić się klasą fpdf i html2pdf
ale wyniki są mizerne w ogóle nie rozpoznaje mi kodu a tym bardziej style :/

Najbardziej zależałoby mi na html do pdf. czy ktsś ma jakiś pomysł?


z góry dziękuje
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #2





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

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


Witam.

Polecam http://www.tcpdf.org/. Patrzyłem na kilka klas pozwalających na html -> pdf i ta jest najlepsza.

Co do styli to daruj sobie , mpdf daje taką możliwość przy tym sypiąc masą błędów!

Czysty html + atrybuty muszą ci wystarczyć.


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
matx132
post
Post #3





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


w tym problem dając nawet powiedzmy w table border="5" to nic nie daje :/
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #4





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

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


Używam tcpdf w jednym projekcie i u mnie działają atrybuty?


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
matx132
post
Post #5





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


chodziło mi o fpdf smile.gif
oczywiście podana przez Ciebie biblioteka działa jak należy lecz coś nie teges, to znaczy nie działają mi polskie fonty mam przerobione jakieś fonty times zrobione według poradniku do fpdf ale napisy są wklepane w całość a ta Klasa jest bardzo fajna smile.gif

Czy mógłbyś mi pomóc z polskimi fontami?
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #6





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

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


Zmień czcionkę w tcpdf_config.php.

Znajdź PDF_FONT_NAME_DATA i spróbuj tak.

  1. define ('PDF_FONT_NAME_DATA', 'dejavusans');


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
matx132
post
Post #7





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


zmieniłem ale nic nadal tak samo:/
w pliku daje także takie coś
  1. $pdf->AddFont('timespl', '', 'timespl.php');
  2. $pdf->AddFont('timespl', 'B', 'timesbdpl.php');
  3. $pdf->AddFont('timespl', 'I', 'timesipl.php');
  4. $pdf->SetFont('timespl','',10);
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #8





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

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


Ok.

A jak wywołujesz obiekt ?

  1. // create new PDF document
  2. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);


Druga sprawa czy zawartość która wrzucasz ma poprawne kodowanie ?


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
matx132
post
Post #9





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


taki mam plik php

  1. require_once('t/config/lang/eng.php');
  2. require_once('t/tcpdf.php');
  3. include_once('test.html');
  4. $htmlbuffer = ob_get_contents();
  5. $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
  6. $pdf->AddPage();
  7. $pdf->AddFont('timespl', '', 'timespl.php');
  8. $pdf->AddFont('timespl', 'B', 'timesbdpl.php');
  9. $pdf->AddFont('timespl', 'I', 'timesipl.php');
  10. $pdf->SetFont('timespl','',10);
  11. $pdf->WriteHTML($htmlbuffer, true, false, true, false, '');
  12. $pdf->Output("file.pdf", "D");


plik test.html w przeglądarce bardzo dobrze się wyświetla
Go to the top of the page
+Quote Post
rocktech.pl
post
Post #10





Grupa: Zarejestrowani
Postów: 587
Pomógł: 131
Dołączył: 8.02.2010

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


1 .Pokombinuj z inną czcionką., wywal to addFont zostaw samo. i zajrzyj do configa tcpdf.
  1. $pdf->SetFont('dejavusans', '', 9);

2. Jak nie zadziała pokaż plik test.html


--------------------
Despite the tons of examples and docs, mod_rewrite is voodoo. Damned cool voodoo, but still voodoo. --Brian Moore

I never go looking for a sucker. I look for a Champion and make a sucker of of him. --Amarillo Slim


Home-made : js-gui-classes | Accordion | Tabs | Carousel / php-sms-classes | Obsługa bramki SMS MultiInfo | Obsługa bramki SMS Mobiltek
Go to the top of the page
+Quote Post
matx132
post
Post #11





Grupa: Zarejestrowani
Postów: 243
Pomógł: 19
Dołączył: 12.09.2005

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


jak dałem
to co pisałeś wyżej działa bardzo dobrze smile.gif
są polskie znaki etc:)

Dziękuje za pomoc
Go to the top of the page
+Quote Post

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 Aktualny czas: 22.08.2025 - 03:22