473,778 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save the current (PHP) page as an HTML file 'to' the client?

scubak1w1
53 New Member
Hello,

I have been Googling for a bit now as to how to let the user save the current page via a 'clickable icon' to an HTML file (i.e., on the client side.)

That is, I am presenting a lot of analytical results (from a PostgreSQL database) and the parameters the user selected on a page as a series of table, etc - with the number of results and hence the number of "little tables" being related to what parameters they chose.

The results_analyti cal_detailed.ph p page presents well...

I have added an icon to save the results, unformatted, as a CSV, works just hunky dory...

aside - I discovered if you make a file with a \t delimiter and \n for the CRs and give the file a *.xls ending, Excel knows how to open this! Users may not have Excel, but in my setting most of them do... and I don't have to write code to strip out all the commas in a bibliography list the user parsed - and indeed would not want to - if I instead wanted to have available as a CSV for the client's download... well, I was happy to find this, even if you knew about it already! :-)

I have added an icon to save the results as an HTML, so they can come back to later, etc, etc (and open in MS Word if they must ;) )

What approach could someone suggest to save the current page as an HTML file to the client?

Note that I have added an icon to save the results as a PDF, and based on a couple of replies to another post I am off to look at how to do this now! :-) What a resource! :-)

Thanks in advance:
GREG...
Mar 6 '08 #1
6 4117
dlite922
1,584 Recognized Expert Top Contributor
Why can't they just use File -> Save ???

it works you know!

PHP is sever side. the client never sees the PHP code. Its HTML that's generated for the browser. Using the save feature of the browser, you can save a copy of that HTML (and depending on your choices) save all the images as well so that it can be opened and it will look the same.

I suggest you open a new window that contains only the data they need (no menu/images that make up the site or frame) and instruct them to go to File-> Save.

Good luck.
Mar 7 '08 #2
scubak1w1
53 New Member
They are managers... they wanted a button, very Dilbertesque... :-)

But thanks... that is what I ended up doing... in small but distinct red text at the top of the page... :-)

Note that I tried using headers and disposition but as you stated/know the client sees the HTML 'version' of the page, so they would get the PHP code as HTML text like [PHP]print "<p>Some paragraph text</.p>";[/PHP] or whatever... I did some reading on using the document object model in javascript or using php output control... ugh... too much for me to learn right now as I have too many other things to do, they can use damn file menu! :-)
Mar 7 '08 #3
hsriat
1,654 Recognized Expert Top Contributor
They are managers... they wanted a button, very Dilbertesque... :-)

But thanks... that is what I ended up doing... in small but distinct red text at the top of the page... :-)

Note that I tried using headers and disposition but as you stated/know the client sees the HTML 'version' of the page, so they would get the PHP code as HTML text like [PHP]print "<p>Some paragraph text</.p>";[/PHP] or whatever... I did some reading on using the document object model in javascript or using php output control... ugh... too much for me to learn right now as I have too many other things to do, they can use damn file menu! :-)
You may also add something like Save a PDF and generate on the fly PDF from the server side when that button clicked.
Mar 8 '08 #4
scubak1w1
53 New Member
You may also add something like Save a PDF and generate on the fly PDF from the server side when that button clicked.
Thank you... I have been looking into that... what is the best method to make a PDF in this fashion? Just a general guide of course.

I have been looking at a bunch of methods, but it looks like I would need to 'reconstruct' the page as a series of code pieces rather than just "print"...
Mar 9 '08 #5
hsriat
1,654 Recognized Expert Top Contributor
Thank you... I have been looking into that... what is the best method to make a PDF in this fashion? Just a general guide of course.

I have been looking at a bunch of methods, but it looks like I would need to 'reconstruct' the page as a series of code pieces rather than just "print"...
That it is, you have to reconstruct the whole data.
Try fpdf.


Harpreet
Mar 10 '08 #6
scubak1w1
53 New Member
thank you... I will do that...

any thoughts on PDFlib, the OS version? (the licensing not withstanding... )
Mar 10 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7049
by: Dominic | last post by:
Hi guys, In .NET, how can I convert a HTML file to TIFF efficiently? One possible way is that I can first use word automatation to load the HTML up and then print it to TIFF. Is that right? However, even if it is technically feasible, it can take long time to do the conversion, especially the HTML is complicated. Is there any other more efficient way? Thanks!
2
7211
by: Zam | last post by:
Hello World, Under Windows 2003 Server. IIS6. The following code working fine for small files, and for files with size about few megabytes. If I am trying to send HUGE file -- about 700 Megabyte -- w3wp.exe eat all memory (I have 1024 megabytes) and all CPU time without positive result.
1
1378
by: tggfang | last post by:
When I build my project file, how can I output the .html file automatically generated to another directory? Anybody can help, Thank you very much!
3
1009
by: Scottie | last post by:
In JavaScript, how do you pass a var from one HTML file to another one? I "own" both of these HTML files. Scott
3
1848
by: yaffa | last post by:
does anyone have sample code for parsting an html file to get contents of a td field to write to a mysql db? even if you have everything but the mysql db part ill take it. thanks yaffa
4
2044
by: dude718 | last post by:
is there a way to import *.html file to message.body string element of mailmessage class without have to actually type it up. Also is the maximum limit to how much can a string hold. I have already set the message.format to html, but i want to some how automatically import the message.body string from an *.html file rather than having to type it up. can anyone help thank
1
1854
by: suresh_nsnguys | last post by:
Hi, I will allow users to download one zip file(contain HTML file and 1 image directory with -gif,jpeg files) to his local hard disk. HTML file contain source code to display images when user execute the 'HTML' file locally.I will display the images present in the local directory one by one in loop until user close the browser. I want to implement like this If i execute the 'HTML' file locally,first it needs to connect...
0
1155
by: harini | last post by:
Hi, I am working on excel VBA and i have a control on my excel sheet say a command button. Now when i click on the command button i shud be able to generate a state web page written using html VBScript. i have my html code in a seperate file. My ques here is how do i link the html file to the control i am using in my excel sheet using excel VBA??? Pls suggest! Thanks!
0
817
by: LakshmiW | last post by:
Hi, I am trying to convert the html file to pdf in a C# windows application where the html is created on fly. Have tried almost many vendor dlls out there like from Aspose, ExpertPDF, itextsharp, DominoPdf and was very disappointed that none of them seem work for me. Are there any others out there which any of you have tried and are very pleased with it please let me know. Thanks, Lakshmi
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10292
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10061
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5368
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5497
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3627
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.