Search code examples
phpjqueryimage-generationdynamic-image-generation

php print and save a div as .jpeg


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


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()