I have a Google spreadsheet with data that will be updated on a weekly basis. I need to bring this data into a HTML table on my website.
Rather than running it through a CSV to HTML converter each time and having to update the HTML code each time, is there a way for me to use PHP or Javascript to look up the Google Spreadsheet URL and convert the data to HTML Table tags without me needing to alter the code each time?
You may be interested in GD API (description concerning spreadsheets).
Default download format is html. Write a script and run in using CRON once a day to pull newest version of you document.
Open your spreadsheet, go to File > Download as > Web page (.html, current sheet)
That should open a link in a new window. This should automatically update when you reload the page after the data has been edited. In jQuery, you can use the .load function to load the data into your page.
Related
I need an online pdf editor so that when I pull the pdf name using php It automatically opens the pdf in the editor and the user can edit the pdf. By edit I mean to chage text, images,etc.... and I want to know how to link php and mysql to it so that when clicking on the pdf name in the database, the pdf is automatically opened via the online editor.
Any recommendation and guides on how to do this ?
I don't know your full requirement here,
but my suggestion is to store HTML versions of the same, this way its gives the flexibility to edit,
also provide a WYSIWYG editor to edit,
and at the time of download, use an HTML to PDF generator.
Also note, you can store the HTML content to DB, or to files, uploads like Image can also be stored into DB (as binary), S3 or somewhere, but decide all that according to your requirement. ~Happy Coding~
I have a HTML page that contains a table with a list of a customers orders (pulled from a database via PHP).
I want to have a button on the page that will allow the users to download a PDF copy excluding the navigation bar etc.
The examples that I've seen and tested online initially load the page in PDF format but I don't want this. I want it to load as it currently is but also have a button that when pressed downloads a PDF copy (i.e. not display it in the browser).
wkhtmltopdf will do the trick:
http://wkhtmltopdf.org/
It should allow you a lot of customization options.
But if you want to generate it dynamically then you have to use some library for pdf . There are many library like tcpdf, dompdf etc.
Dom pdf example
From experience I would recommend Phantom JS - see an example
I found Phantom JS offers better HTML/CSS support when compared to wkhtmltopdf.
Bear in mind, you will struggle to get support for things like CSS3 columns in Phantom and Wkhtmltopdf.
Workflow:
Land on initial page (later to be converted to PDF).
Display button - 'download as PDF'
Listen for the click event on this button and call a custom callback
function once the event is fired.
The callback function executes an Ajax call sending the full page
HTML as part of the server request.
On server side, fire up Phantom JS or Wkhtmltopdf to generate PDF. Save
PDF on server.
Generate URL for saved PDF and display/load client side.
PS; I'm not sure if Phantom JS will generate a PDF from a string or whether it expects a valid url. I know Wkhtmltopdf can generate a PDF from a string.
Hope this helps
Since you ask for the easiest way.. just print the HTML client side. This button invokes printing the web page client side:
<input type="button"
onClick="window.print()"
value="Print This Page"/>
Then the user would have to select a PDF printer driver. Chrome has this built in.
Here you can read how to exclude parts of the HTML (such as the print button itself) from being printed:
How do I hide an element when printing a web page?
I need to display all students detail in the table format while clicking the "Print" link in my web page. Users may print these records in this page. It may have several thousands of records.
Because of this, it took more time to load. Is it possible to load records page by page? Or am i need to do any other thing to reduce the loading time?
Please advice.
Note: I have optimized my code as much as possible as per the Google search.
I would install wkhtmltopdf, I would use a html template, then generate a pdf file using the html template when changes are made to the list, and download that file when needed.
This way, you save processing power, and the users download the same file.
Also, by doing so, most browsers know how to render a pdf file without downloading it
Yes, using CPagination class
You have an example in that Doc page.
You will have to paginate the records, if they are in DB, Yii will instruct the db engine to only retrieve the records in a range, making it efficiently.
I have a form that generates an SQL statement, based on the users choices. It is functioning much like the report wizard in MS Access. On the last step, I have all the data, and the dynamically generated SQL query, but I need a way where they can download it as a file. How should I go about this?
Currently I have three buttons called
'View Results' (which just shows HTML generated results, that is easy - they just open up in a new tab)
'Download CSV' (preferably I would like this when clicked to just act like a normal download of a file, the user gets prompted to save as etc by the browser)
'Download PDF' (same as CSV)
At the moment when the CSV button is pressed a new tab opens up with export_report.php,
which outputs CSV style report data.
How can I achieve the desired results with the CSV and PDF button? I have all the data and information I need to generate either but I am unsure how to proceed forward with this.
For the generation of the PDF you could use fpdf witch allows you to build a pdf from php.
For the generation of the CSV you only have to adjust the headers. Here is a link that explains how this works: csv generation.
From last 6 hours trying best to show progress bar wile pdf is generated in TCPDF but not successful.
I am using TCPDF API for HTML to PDF generation, But the problem is that while generating the PDF we can't use custom javascript, Can we show progress bar while PDF is generated?
Any idea please?
I am not sure why you say "can't use custom javascript". If you just want a "loading icon" yoy should do this
- show loading icon (from js)
- ajax request to php file that generates the pdf into a server file
- on success you get a link to a generated pdf.
(for this solution you might try some estimation based on how large would be the generated file)
If you want an accurate progressive, you should add some estimation on php file. Let's say when you generate the pdf you know how many pages you will generate and each "addPage" command you save the status of completeness in a file or a memcached key. On you JavaScript side you call a file each second that reads that status of completeness.
No.
Even if you were able to use custom javascript, it would not be possible to get an accurate prediction of the time it will take to generate the document and therefore diplay progress - but it would be possible to get an estimate (based on extensive benchmarking). But in order to display the progress bar you'd need custom javascript and to change the processing to decouple the threads on the browser and server. This is discussed more in this question (which IMHO is not a duplicate of the post referenced).