Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP to word.

Status
Not open for further replies.

LordGarfield

IS-IT--Management
Jul 31, 2003
112
BE
Hi

In asp you can put 2 lines infront of the <head> tag
so that if you load the page it will prompt you to save a word .doc file wich is generated by the asp code.

the 2 lines are
<% Response.ContentType = &quot;application/msword&quot;
Response.AddHeader &quot;Content-Disposition&quot;, &quot;attachment;filename=navprob.doc&quot;
%>

How do I do the same in PHP?

tank you.
 
Directly from the PHP manual that you can find here:


I'm fairly certain this will be do what you want...

Code:
<?php
// We'll be outputting a PDF
header(&quot;Content-type: application/pdf&quot;);

// It will be called downloaded.pdf
header(&quot;Content-Disposition: attachment; filename=downloaded.pdf&quot;);

// The PDF source is in original.pdf
readfile('original.pdf');
?>

All the best,
Jeff
 
hi,

It was not exactly what I was looking for. In your script you have created a pdf file (original.pdf). If you link to it it normaly shows the pdf in your browser but you just force it to be dowlloaded.. that is ok. But I created a webpage in pure html and php (displays some stuff out of a mysql db).

Now I do not want them to see the information online I just want to convert the html file to word and force them to download it.

so from the moment they come on this webpage. the webpage will be converted to word and they can dowload it.

tanks already.
mvg roel.
 
can't you just save the doc on to the server and link it to the site to open automatically on page load?!



Make Sense? I hope so (-:
 
No that is not the meaning of it..

The meaning is to generate a word document with php code and let peaple download it automaticaly. So they visit a page and filter on certain criteria. They get the restult back in a word doc. so I can not know what they are gonna look for and I can not upload milions of docs with search resulst.

In asp it is perfectly posible. I dit that already and it works fine but I wanne use PHP now.

mvg roel.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top