freelance84 Posted August 6, 2010 Share Posted August 6, 2010 There is a section in my site in which i will need to give the user 3 options: Generate Specific User Text As: 1. pdf 2. .doc 3. .txt 4. print in html The 4th option is simple. The other three are completely new to me. I know little bit about fopen, fwrite and fclose, however these are commands that write files to the server. I need to write files to the users computer. Is the best way for this to be: 1. the user clicks .txt 2. the .txt is written to the server 3. the .txt is then downloaded to the users computer by the user 4. the .txt is then deleted from the server All 4 steps to be done with one click from the user. Might there not be traffic problems if lots and lots of users are doing this at the same time? Any pushes in right direction here would be great, there seems to be hundreds of sites saying different solutions Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/ Share on other sites More sharing options...
JonnoTheDev Posted August 6, 2010 Share Posted August 6, 2010 I need to write files to the users computer Impossible. 1. the user clicks .txt 2. the .txt is written to the server 3. the .txt is then downloaded to the users computer by the user 4. the .txt is then deleted from the server This is correct. Might there not be traffic problems if lots and lots of users are doing this at the same time? No, just make sure you give each file created a unique name so one user cannot overwrite anothers if running at the same time. You can create word documents using fopen(), fwrite(), etc and save the file with a .doc extension, However if you want a properly formatted document you require COM objects (windows servers only). For PDF generation I recommend the following http://www.fpdf.org/ Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1095982 Share on other sites More sharing options...
freelance84 Posted August 6, 2010 Author Share Posted August 6, 2010 Brilliant thanks neil Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1096004 Share on other sites More sharing options...
freelance84 Posted August 6, 2010 Author Share Posted August 6, 2010 Is it only possible to create fully formatted word documents on windows servers (i'm on a linux server at the moment)? Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1096022 Share on other sites More sharing options...
JonnoTheDev Posted August 6, 2010 Share Posted August 6, 2010 Windows, as you would need MS Word installed on the server. http://www.php.net/manual/en/intro.com.php Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1096043 Share on other sites More sharing options...
freelance84 Posted August 8, 2010 Author Share Posted August 8, 2010 Ah i see. I've just been having a browse through the openOffice version at: http://www.odtphp.com/index.php?i=home Have you or anybody else had any experience with this? Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1096739 Share on other sites More sharing options...
FredFogg Posted August 9, 2010 Share Posted August 9, 2010 Is there any example code of how to do this? I am somewhat new to PHP and am still learning. I want to query a MySQL database and write out the result to a txt file the user can download. 1. the user clicks .txt 2. the .txt is written to the server 3. the .txt is then downloaded to the users computer by the user 4. the .txt is then deleted from the server Quote Link to comment https://forums.phpfreaks.com/topic/209971-generating-txt-doc-or-pdf/#findComment-1096866 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.