Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Dynamic PDF Generation of HTML using PHP
April 25, 2006, 6:32 pm
rate this thread
I am looking for php tools / scripts with which I can convert php
generated HTML to PDF. I was looking at FPDF and HTML2PDF (based on
FPDF). However, HTML2PDF can not handle nested lists and the output is
wrong. If I generate a PDF from:
the ouput looks like:
Maybe I did something wrong, but I could not find any error. Does
anybody know free php libraries cabable of handling nested lists?
Thanks a lot,
Re: Dynamic PDF Generation of HTML using PHP
Author: Muhammad Azeem Abbas (---.net.pk)
Date: 09-17-05 06:31
Use PHP str_replace(); Function before passing your HTML Tags to PDF.
$html = str_replace( '<ul>', "" , $html );
$html = str_replace( '<li>', "->" , $html );
$html = str_replace( '</li>', "\n" , $html );
$html = str_replace( '</ul>', "" , $html );
Replace <li> tag with any character that shows a bullet, and replace
</li> to a new line.