HTML code to PDF

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

HTML code to PDF

Post by icesolid »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Is there any REALLY good HTML code to PDF source codes out there.

I have tried HTML 2 (F)PDF Project and it works ok.  However, it does not have the ability to produce PDFs from more complex HTML like the code below.  I just would like to find a HTML code to PDF source code that I can throw whatever code will work on the web at it and it will be able to convert it.  Without using things like create_table();  create_cell();.  The source codes that use that style of producing a PDF do not help me very much because after I go and make this nice HTML code for a form on the web, now I have to re-create it using those functions.

Below is just an example of a Word Document form that I converted to HTML for the web and works great on the web.  However, the HTML 2 (F)PDF Project will not convert it correctly.

[syntax="html"]<table align="center" class=MsoNormalTable border=1 cellspacing=0 cellpadding=0 width=612
 style='width:459.0pt;margin-left:-.05in;border-collapse:collapse;border:none'>
 <tr>
  <td width=612 colspan=8 valign=top bgcolor="#B3B3B3" style='width:459.0pt;
  border:solid windowtext 1.0pt;background:#B3B3B3;padding:0in 5.4pt 0in 5.4pt'>
  <p class=MsoNormal align=center style='text-align:center'><b><font size=3
  face="Times New Roman"><span style='font-size:12.0pt;font-weight:bold;text-align:center;'>Survey
  Information</span></font></b></p>
  </td>
 </tr>

feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

With all those styles, i doubt there is a html to pdf converter that can do that. It is WAY better&faster to just skip generating the html, and go straight to pdf.

And making forms in Microsoft Word? That just bloats and creates unnecessary (Recursive) html.
icesolid wrote:

Code: Select all

<p class=MsoNormal align=center style='text-align:center'><b><font size=3
  face="Times New Roman"><span style='font-size:12.0pt;font-weight:bold;text-align:center;'>Survey
  Information</span></font></b></p>
That is like telling the Text to..
  • Align Center
  • Align Center
  • Bold
  • Font size 3
  • Font Type Times New Roman
  • Font size 12
  • Bold
  • Align Center
I think you Wanted the Text Aligned center.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Post by icesolid »

Straight to PDF?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

Brooksie155
Forum Newbie
Posts: 1
Joined: Tue Oct 09, 2007 6:04 am

Post by Brooksie155 »

One posibililty you could try is DomPDF, it has some pretty good support for styles, however your HTML code as to be pretty exact, and it doesn't always like it if your HTML runs over mulitiple pages - especially if you are using tables as well.

Thus I am on the search for an alternative.... of which teh best so far seems to be PDFlib - but it's pricey.

Does anybody know of some other alternatives?

Thanks.
Post Reply