Question

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

Was it helpful?

Solution

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

windows.print()

OTHER TIPS

  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.

To auto open the print dialogue:

function printpage() {
    window.print();
}

Or just straight out call window.print();

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top