Logo


Zapraszam pod nowy adres, pod którym mam nadzieję zmiany będą częściej http://devel.jdstar.pl.

Konwersja z HTML do PDF w PHP - dompdf

2007-08-09 JDStar


Ostatnie artykuły

Próbnik koloru (color picker?) - pomoc w wyborze schematu kolorystycznego strony komentarzy [7]
Konwersja z HTML do PDF w PHP - dompdf komentarzy [54]
Generowanie dokumentów PDF z HTML w PHP (dompdf, HTML2FPDF, TCPDF) komentarzy [141]
Podpowiedzi na www valid XHTML - czyli dymki, tooltip'y lub inne nazwy (nie wiem jakie) komentarzy [89]
Rozszerzenia Firefox'a, których używam - przydatne dla webdeveloperów/webmasterów komentarzy [112]

Generowanie PDF przy użyciu biblioteki dompdf (http://www.digitaljunkies.ca/dompdf/).

Przykład oprę na tym samym dokumencie HTML co poprzednio.

Ściągamy dompdf, rozpakowujemy.

Jedyne co może być potrzebne to zmiana w pliku konfiguracyjnym:


define("DOMPDF_PDF_BACKEND", "cpdf");

Zamiast "cpdf" mamy domyślnie do wyboru: PDFLib, GD lub auto - niestety kodowanie UTF-8 oferuje (tak jest napisane w dokumentacji PDFLib, ale jedynie w pełnej wersji - niestety do takiej nie mam dostępu więc nie sprawdziłem). Pozostałe biblioteki nie mają wsparcie dla UTF-8.

Dołączenie biblioteki dompdf i wczytanie pliku robimy w ten sposób:

<?php
require_once("dompdf_config.inc.php");
$dompdf = new DOMPDF();
$dompdf->load_html_file("../html_test1.html");
$dompdf->render();
$dompdf->stream("hello.pdf");
?>

Niestety plik wynikowy nie posiada polskich znaków diakrytycznych - więc musimy poczekać aż autor doda wsparcie dla UTF-8.

Jest to jednak moim zdaniem biblioteka oferująca największe wsparcie i zgodność ze stylami CSS, dokument wyjściowy PDF ma praktycznie taki sam układ jak jego wersja pierwotna w HTML.

Jeśli ktoś zna rozwiązanie problemu z kodowaniem "pliterek" w dompdf proszę o kontakt lub info w komentarzu.

dodaj komentarz

1: 2007-09-13 19:40:18, nie podano:
nie podano

2: 2009-07-16 18:21:50, Konki:
Rozwiązanie problemu na stronie:
bukox.pl/php/dompdf-i-polskie-znakie

Opis komentarze

3: 2011-03-20 10:05:39, baleon:
tego właśnie szukałem
kolega z pracy się męczył żeby przepisać htmla do pdfa. wiedziałem ze jest "gotowiec" ale nie chciał słuchać

4: 2024-05-31 10:12:18, drainage tunbridgewells:
I've ƅeen exloring for a littfle fоr any higһ quality articles
or blog posts onn tһіs kind of area . Exploring inn Yaһo I ultimаteⅼy stumbled upon ths wweb
site. Studying this info So i'm hɑppy to express that I have an іncredibⅼy excellent uncanny feeling I found outt just wnat I needed.

I most undoubtedly will make sure to don?t overlook tyis websute ɑand
give it a glance ߋn ɑ constant basis.

5: 2024-12-01 03:51:06, http://thecentersucks.com/__media__/js/netsoltrademark.php?d=the-moto.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3Dfinance20240818.Blogspot.com%252F2024%252F08%252Fbotforex.html:
I've been surfing online more than three hours today, yet I
never found any interesting article like yours. It is pretty worth enough for me.

Personally, if all web owners and bloggers made good content as you did,
the internet will be a lot more useful than ever before.|
I could not resist commenting. Perfectly written!|
I will immediately seize your rss feed as I can't in finding your email
subscription hyperlink or e-newsletter service.

Do you have any? Kindly let me know in order that I may subscribe.
Thanks.|
It's appropriate time to make some plans for the future and it's time to be happy.

I have read this post and if I could I wish to suggest you few interesting things or suggestions.
Perhaps you could write next articles referring to this article.
I wish to read more things about it!|
It's perfect time to make some plans for the future and it is time to
be happy. I've read this put up and if I may I desire to counsel you few interesting
issues or tips. Maybe you could write next articles regarding this article.
I wish to read even more issues approximately it!|
I have been surfing online greater than three hours these days, but I by no means discovered any fascinating article like yours.

It's pretty value enough for me. Personally, if all webmasters and bloggers
made excellent content material as you probably did, the net will be much more helpful than ever before.|
Ahaa, its good conversation regarding this piece of writing here at this webpage, I have read all that, so at this time me also commenting here.|
I am sure this piece of writing has touched all the internet visitors, its
really really good post on building up new website.|
Wow, this paragraph is pleasant, my sister is
analyzing these things, therefore I am going to tell her.|
Saved as a favorite, I love your web site!|
Way cool! Some very valid points! I appreciate you writing this write-up and also the rest of the site is also really good.|
Hi, I do thi

6: 2024-12-01 03:52:11, http://thecentersucks.com/__media__/js/netsoltrademark.php?d=the-moto.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3Dfinance20240818.Blogspot.com%252F2024%252F08%252Fbotforex.html:
I've been surfing online more than three hours today, yet I
never found any interesting article like yours. It is pretty worth enough for me.

Personally, if all web owners and bloggers made good content as you did,
the internet will be a lot more useful than ever before.|
I could not resist commenting. Perfectly written!|
I will immediately seize your rss feed as I can't in finding your email
subscription hyperlink or e-newsletter service.

Do you have any? Kindly let me know in order that I may subscribe.
Thanks.|
It's appropriate time to make some plans for the future and it's time to be happy.

I have read this post and if I could I wish to suggest you few interesting things or suggestions.
Perhaps you could write next articles referring to this article.
I wish to read more things about it!|
It's perfect time to make some plans for the future and it is time to
be happy. I've read this put up and if I may I desire to counsel you few interesting
issues or tips. Maybe you could write next articles regarding this article.
I wish to read even more issues approximately it!|
I have been surfing online greater than three hours these days, but I by no means discovered any fascinating article like yours.

It's pretty value enough for me. Personally, if all webmasters and bloggers
made excellent content material as you probably did, the net will be much more helpful than ever before.|
Ahaa, its good conversation regarding this piece of writing here at this webpage, I have read all that, so at this time me also commenting here.|
I am sure this piece of writing has touched all the internet visitors, its
really really good post on building up new website.|
Wow, this paragraph is pleasant, my sister is
analyzing these things, therefore I am going to tell her.|
Saved as a favorite, I love your web site!|
Way cool! Some very valid points! I appreciate you writing this write-up and also the rest of the site is also really good.|
Hi, I do thi

7: 2024-12-01 03:52:16, http://thecentersucks.com/__media__/js/netsoltrademark.php?d=the-moto.com%2F__media__%2Fjs%2Fnetsoltrademark.php%3Fd%3Dfinance20240818.Blogspot.com%252F2024%252F08%252Fbotforex.html:
I've been surfing online more than three hours today, yet I
never found any interesting article like yours. It is pretty worth enough for me.

Personally, if all web owners and bloggers made good content as you did,
the internet will be a lot more useful than ever before.|
I could not resist commenting. Perfectly written!|
I will immediately seize your rss feed as I can't in finding your email
subscription hyperlink or e-newsletter service.

Do you have any? Kindly let me know in order that I may subscribe.
Thanks.|
It's appropriate time to make some plans for the future and it's time to be happy.

I have read this post and if I could I wish to suggest you few interesting things or suggestions.
Perhaps you could write next articles referring to this article.
I wish to read more things about it!|
It's perfect time to make some plans for the future and it is time to
be happy. I've read this put up and if I may I desire to counsel you few interesting
issues or tips. Maybe you could write next articles regarding this article.
I wish to read even more issues approximately it!|
I have been surfing online greater than three hours these days, but I by no means discovered any fascinating article like yours.

It's pretty value enough for me. Personally, if all webmasters and bloggers
made excellent content material as you probably did, the net will be much more helpful than ever before.|
Ahaa, its good conversation regarding this piece of writing here at this webpage, I have read all that, so at this time me also commenting here.|
I am sure this piece of writing has touched all the internet visitors, its
really really good post on building up new website.|
Wow, this paragraph is pleasant, my sister is
analyzing these things, therefore I am going to tell her.|
Saved as a favorite, I love your web site!|
Way cool! Some very valid points! I appreciate you writing this write-up and also the rest of the site is also really good.|
Hi, I do thi

8: 2025-01-03 03:49:24, webpage:
I am really glad to read this website posts which includes tons of helpful information, thanks for
providing these data.

9: 2025-01-03 03:50:29, webpage:
I am really glad to read this website posts which includes tons of helpful information, thanks for
providing these data.

10: 2025-01-03 03:51:34, webpage:
I am really glad to read this website posts which includes tons of helpful information, thanks for
providing these data.

11: 2025-01-03 03:52:39, webpage:
I am really glad to read this website posts which includes tons of helpful information, thanks for
providing these data.

12: 2025-01-11 06:13:22, his comment is here:
With thanks! I appreciate it!

13: 2025-01-11 06:14:27, his comment is here:
With thanks! I appreciate it!

14: 2025-01-11 06:15:32, his comment is here:
With thanks! I appreciate it!

15: 2025-01-11 06:16:37, his comment is here:
With thanks! I appreciate it!

16: 2025-01-13 16:15:27, spacenet one television:
This is a great tip particularly to those new to the blogosphere.
Brief but very precise info… Many thanks for sharing this one.
A must read article!

17: 2025-01-13 23:19:42, Какие животные продаются в зоомагазине:
Минусом питомца является стремление что-либо погрызть – это надо контролировать.

18: 2025-02-12 03:50:57, 按摩課程:
https://catering18c.z33.web.core.windows.net/research/catering18c-(218).html
Keep the traces of communication open throughout the wedding planning course of.

19: 2025-02-12 03:52:02, 按摩課程:
https://catering18c.z33.web.core.windows.net/research/catering18c-(218).html
Keep the traces of communication open throughout the wedding planning course of.

20: 2025-02-12 03:53:07, 按摩課程:
https://catering18c.z33.web.core.windows.net/research/catering18c-(218).html
Keep the traces of communication open throughout the wedding planning course of.

21: 2025-02-12 03:54:12, 按摩課程:
https://catering18c.z33.web.core.windows.net/research/catering18c-(218).html
Keep the traces of communication open throughout the wedding planning course of.

22: 2025-02-12 03:55:47, 按摩學徒:
https://ya-drbogin-14.blr1.digitaloceanspaces.com/the-impact-of-massage-on-musculoskeletal-health.html
The thing about the gold hue is that it is naturally attractive!

23: 2025-02-12 03:56:52, 按摩學徒:
https://ya-drbogin-14.blr1.digitaloceanspaces.com/the-impact-of-massage-on-musculoskeletal-health.html
The thing about the gold hue is that it is naturally attractive!

24: 2025-02-12 03:57:57, 按摩學徒:
https://ya-drbogin-14.blr1.digitaloceanspaces.com/the-impact-of-massage-on-musculoskeletal-health.html
The thing about the gold hue is that it is naturally attractive!

25: 2025-02-12 03:59:02, 按摩學徒:
https://ya-drbogin-14.blr1.digitaloceanspaces.com/the-impact-of-massage-on-musculoskeletal-health.html
The thing about the gold hue is that it is naturally attractive!

26: 2025-02-20 03:30:31, Женский клуб онлайн | Нижневартовск:
Женский клуб в Нижневартовске в телеграм - женский клуб для тебя!

Обсуждаем, комментируем, делимся своими
историями, обучающими материалами, хорошим
настроением и новостями.
Большое количество нужного: психология, мастер-классы, вопросы, ответы и многое другое.
Ждём наших дорогих подписчиц в добром и светлом женском клубе.

#Нижневартовск #ЖенскийклубНижневартовск #ЖенскийНижневартовск #смотретьженский #женскийинтернет #телеграм #телеграмм #telegram
Подпишись, чтобы не потерять... Женский клуб онлайн | Нижневартовск
Женские пространства в других городах России:https://vk.com/@861607258-zhenskii-klub

27: 2025-02-26 03:07:04, 經絡按摩證照:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/accounting2/research/accounting2-(212).html
Straight-leg pants create a streamlined silhouette that subtly enhances the
velvet burnout-print top and jacket.

28: 2025-02-27 03:50:09, 台中 撥筋:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-278/research/je-tall-sf-marketing-(383).html
Here's one other one of the best mother-of-the-bride clothes you ought to buy online.

29: 2025-02-27 03:51:14, 台中 撥筋:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-278/research/je-tall-sf-marketing-(383).html
Here's one other one of the best mother-of-the-bride clothes you ought to buy online.

30: 2025-02-27 03:52:19, 台中 撥筋:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-278/research/je-tall-sf-marketing-(383).html
Here's one other one of the best mother-of-the-bride clothes you ought to buy online.

31: 2025-02-27 03:53:24, 台中 撥筋:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-278/research/je-tall-sf-marketing-(383).html
Here's one other one of the best mother-of-the-bride clothes you ought to buy online.

32: 2025-03-07 04:09:13, Buy 2000 Cheap Proxies:
Please let me know if you're looking for a writer for your site.
You have some really great posts and I think I would
be a good asset. If you ever want to take some of the load off,
I'd absolutely love to write some articles for your blog in exchange for a link back to mine.
Please send me an e-mail if interested. Thank you!

33: 2025-03-09 03:50:42, 推拿師:
https://jekyll2.s3.us-west-002.backblazeb2.com/je-20250224-3/research/marketing-(112).html
An imported diamond within the rough, the Adrianna Papell Floral Beaded Gown is a real stunner.

34: 2025-03-09 03:51:47, 推拿師:
https://jekyll2.s3.us-west-002.backblazeb2.com/je-20250224-3/research/marketing-(112).html
An imported diamond within the rough, the Adrianna Papell Floral Beaded Gown is a real stunner.

35: 2025-03-09 03:52:52, 推拿師:
https://jekyll2.s3.us-west-002.backblazeb2.com/je-20250224-3/research/marketing-(112).html
An imported diamond within the rough, the Adrianna Papell Floral Beaded Gown is a real stunner.

36: 2025-03-09 03:53:57, 推拿師:
https://jekyll2.s3.us-west-002.backblazeb2.com/je-20250224-3/research/marketing-(112).html
An imported diamond within the rough, the Adrianna Papell Floral Beaded Gown is a real stunner.

37: 2025-03-10 03:36:44, luxury spa massage:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-13/research/je-tall-sf-marketing-(422).html
The capelet dress is right when you like to cowl up your upper arms.

38: 2025-03-10 03:37:49, luxury spa massage:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-13/research/je-tall-sf-marketing-(422).html
The capelet dress is right when you like to cowl up your upper arms.

39: 2025-03-10 03:38:54, luxury spa massage:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-13/research/je-tall-sf-marketing-(422).html
The capelet dress is right when you like to cowl up your upper arms.

40: 2025-03-10 03:39:59, luxury spa massage:
https://filedn.eu/lXvDNJGJo3S0aUrNKUTnNkb/marketing-13/research/je-tall-sf-marketing-(422).html
The capelet dress is right when you like to cowl up your upper arms.

41: 2025-03-10 03:48:56, 按摩教學:
https://je-tall-sf-marketing-10.b-cdn.net/research/je-tall-sf-marketing-(183).html
Kay Unger’s maxi romper combines the look of a maxi costume with pants.

42: 2025-03-10 03:50:01, 按摩教學:
https://je-tall-sf-marketing-10.b-cdn.net/research/je-tall-sf-marketing-(183).html
Kay Unger’s maxi romper combines the look of a maxi costume with pants.

43: 2025-03-10 03:51:06, 按摩教學:
https://je-tall-sf-marketing-10.b-cdn.net/research/je-tall-sf-marketing-(183).html
Kay Unger’s maxi romper combines the look of a maxi costume with pants.

44: 2025-03-10 03:52:11, 按摩教學:
https://je-tall-sf-marketing-10.b-cdn.net/research/je-tall-sf-marketing-(183).html
Kay Unger’s maxi romper combines the look of a maxi costume with pants.

45: 2025-03-11 03:56:21, Conclusion:
Excellent post. I used to be checking continuously this blog and I am impressed!
Very useful info particularly the remaining section :) I care for such information much.
I used to be looking for this particular info for a long
time. Thanks and best of luck.

46: 2025-03-11 03:57:26, Conclusion:
Excellent post. I used to be checking continuously this blog and I am impressed!
Very useful info particularly the remaining section :) I care for such information much.
I used to be looking for this particular info for a long
time. Thanks and best of luck.

47: 2025-03-11 03:58:31, Conclusion:
Excellent post. I used to be checking continuously this blog and I am impressed!
Very useful info particularly the remaining section :) I care for such information much.
I used to be looking for this particular info for a long
time. Thanks and best of luck.

48: 2025-03-11 04:04:29, 按摩課程:
https://je-tall-sf-marketing-71.b-cdn.net/research/je-tall-sf-marketing-1-(490).html
The subsequent thing you want to consider when buying round for attire is the form of
the costume.

49: 2025-03-11 04:05:35, 按摩課程:
https://je-tall-sf-marketing-71.b-cdn.net/research/je-tall-sf-marketing-1-(490).html
The subsequent thing you want to consider when buying round for attire is the form of
the costume.

50: 2025-03-11 04:06:40, 按摩課程:
https://je-tall-sf-marketing-71.b-cdn.net/research/je-tall-sf-marketing-1-(490).html
The subsequent thing you want to consider when buying round for attire is the form of
the costume.

51: 2025-03-20 03:37:38, Berita Internasional:
hi!,I love your writing so a lot! proportion we communicate extra approximately your post on AOL?
I require an expert in this space to solve my problem.
Maybe that is you! Having a look forward to peer you.


https://lipimagazine.com/

52: 2025-03-20 03:38:43, Berita Internasional:
hi!,I love your writing so a lot! proportion we communicate extra approximately your post on AOL?
I require an expert in this space to solve my problem.
Maybe that is you! Having a look forward to peer you.


https://lipimagazine.com/

53: 2025-03-20 16:38:35, 撥筋課程:
https://ya-tendoncare-5.ewr1.vultrobjects.com/tutorial-on-pulling-tendons-how-to-pull-tendons-to-improve-happiness-1.html
From impartial off-white numbers to daring, punchy,
and fashion-forward designs, there's one thing right here that may suit her fancy.

54: 2025-03-22 19:25:46, vách ngăn vệ sinh:
Howdy! I could have sworn I've been to this blog before but
after browsing through a few of the articles I realized it's new to me.
Anyhow, I'm definitely delighted I stumbled upon it and I'll be bookmarking it and checking back often!