HTML to PDF or EXCEL

Status
Not open for further replies.

HairyHun

Masturbating Bandit
Oct 11, 2007
576
2
0
Hi Guys,

Im trying to export my leads listings into PDF or EXCEL in a way that keep the formatting.

Been trying to find a easy to use free (or cheap) php script, everything is or very expensive or very technical.

ideally if I can replicate the html look on pdf would be awesome. I would need some page control ( new page)

Any suggestions?

Thanks
HH
 


You could try HTML 2 PDF on SourceForge. Otherwise try a Google search and check out some of the other tools and resources.

You could try a Javascript solution to convert HTML to Excel. Otherwise you can try another Google search. The results for a search for "html to excel" stink, so try messing around with search terms.

What language are you looking towards for your solution? Javascript? PHP? ASP? It should be a cinch to do HTML to Excel using ASP.

Good luck.
 
To get an excel file you'd do something like this, it's really pretty easy.

Essentially, build a really big string that is made of comma separated data and end with the proper cr/lf. I can't remember, \r, \n or \r\n. Be sure to use ,, for any cells that would be empty.

Then you'd use some code to download the file like this.
Code:
# This line will stream the file to the user rather than spray it across the screen
header("Content-type: application/octet-stream");

# replace excelfile.xls with whatever you want the filename to default to
header("Content-Disposition: attachment; filename=excelfile.xls");
header("Pragma: no-cache");
header("Expires: 0");

echo $header."\n".$data;

If all else fails do a search at hotscripts.com
 
Y
What language are you looking towards for your solution? Javascript? PHP? ASP? It should be a cinch to do HTML to Excel using ASP.

Good luck.

I use and am familiar with PHP. My hosting might support ASP ( probably does ) PHP would be ideal tho

HH
 
Save the file, open it in OpenOffice as a doc, export to PDF.

Not 100% sure if OO will open HTML -- never tried -- but it would be kinda silly if it didn't.


Frank
 
Save the file, open it in OpenOffice as a doc, export to PDF.

Not 100% sure if OO will open HTML -- never tried -- but it would be kinda silly if it didn't.


Frank

Wow :bowdown:

But actually, the whole operation must be automated on the click of a button on the website. :)

Otherwise manually I can do it 25 different ways. :rasta:

HH
 
You could try HTML 2 PDF on SourceForge. Otherwise try a Google search and check out some of the other tools and resources.


I tried HTML2FPDF. It's nice script but there is not much documentation available.

I was able to make it work for HTML files but I'm having trouble for generated files ( using PHP) It gives me a half of tag only for the output

Using variables it completely fails to operate

I found a forum post on the internet where some tried something similar, what they did is use the ob_start(); ob_end_clean(); commands to somehow capture the php output and put it right back into the script.

This work, but only the formatting was missing. I got the php output, the css, except the tables.


Did anyone personally try something like this and might have some pointers.

Thanks
 
I tried HTML2FPDF. It's nice script but there is not much documentation available.

I was able to make it work for HTML files but I'm having trouble for generated files ( using PHP) It gives me a half of tag only for the output

Using variables it completely fails to operate

I found a forum post on the internet where some tried something similar, what they did is use the ob_start(); ob_end_clean(); commands to somehow capture the php output and put it right back into the script.

This work, but only the formatting was missing. I got the php output, the css, except the tables.


Did anyone personally try something like this and might have some pointers.

Thanks

I've been using this for ages:
rustyparts.com | HTML_ToPDF: create PDF's on the fly

Works great, I believe you need html2ps and ps2pdf installed.
 
Status
Not open for further replies.