By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,257 Members | 928 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,257 IT Pros & Developers. It's quick & easy.

Dynamic PDF Generation of HTML using PHP

P: n/a
Hi,

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:

<ul>
<li>L1</li>
<li>L2</li>
<ul>
<li>SL1</li>
</ul>
<li>L3</li>
</ul>

the ouput looks like:

- L1
- SL1
- L4

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,

-- Frank

Apr 25 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
correction:

the output is:

- L1
- SL1
- L3

instead of

- L1
- L2
- SL1
- L3

-- Frank

Apr 25 '06 #2

P: n/a
This from fpdf fourm...

Author: Muhammad Azeem Abbas (---.net.pk)
Date: 09-17-05 06:31

Use PHP str_replace(); Function before passing your HTML Tags to PDF.
Write

$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.

HIH

Apr 25 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.