Take the 2-minute tour ×

Possible Duplicate:
How to save webpage as a image file using PHP?

i want user to enter few inputs then when he is done click save

all his inputs are sent to a php file that save these inputs and responde with

a new printable page that have a background image,and all inputs are shown on list positioned by css. enter image description here

my question is is it possible to ..

  1. trigger auto print after page showup
  2. save this entier page as single jpeg on server

my small project is using:php-html5-jquery-codeigniter 2

share|improve this question
add comment

marked as duplicate by jeroen, Jocelyn, Justin Satyr, Martin Buberl, Perception Jan 15 '13 at 4:21


4 Answers

up vote 4 down vote accepted

You can generate a JPG of the page server-side using the GDI+ but it would require you placing text, etc, not relying on CSS, and a browser for layout... Failing that, you'd be better off generating a PDF which is designed for this.

As to printing, you can trigger the print dialogue using the following Javascript

share|improve this answer
And if user will be using WebKit printing dialog will show up where he can save it to PDF with no problem. –  Steve Jan 14 '13 at 17:16
There are a number of ways to Print to Pdf on the client - WebKit browsers, PDF Writers for msot OSes, etc... The problem is, you can't just assume, you need to cater for the lowest possible denominator - which means server-side generation –  Basic Jan 14 '13 at 17:54
add comment
  1. Yes. Call window.print() on load.
  2. Yes, but that would be more difficult. You would need to generate your output as an image. PDF would probably be an easier option.
share|improve this answer
add comment

To auto open the print dialogue:

function printpage() {

Or just straight out call window.print();

share|improve this answer
add comment

You can either muck about with PDF generation, or you can set up print-friendly CSS.

share|improve this answer
add comment
