emulate the browser print preview feature in php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi all,

is there a solution to the problem stated here :-

http://stackoverflow.com/questions/953396/how-to-display-a-print-preview-of =

the problem is as follows :-

I need to display some HTML content as it will be printed. Basically,
I want to emulate the browser print preview feature.

I'm not sure how to do this just with HTML/CSS/JavaScript. The only
solution I came up is to convert the HTML to PDF so it=B4s split into
pages and then convert that PDF to images and print each image one
bellow the other.

It will be really helpfull if someone can point a more straight
forward method. I'm not even sure if this is posibble.
BTW, I'm using PHP in the backend, so if there is a PHP class for this
it will be helpfull.

The page size for diplaying it will be letter no matter what the user
have configured

Re: emulate the browser print preview feature in php

Hash: SHA1

annalissa wrote:
Quoted text here. Click to load it
Quoted text here. Click to load it


the fasted and easiest way to do this, is to include a print css file:

<link rel="stylesheet" type="text/css" href="print.css" media="print" />

This way the browser will use this and formats the page according to the
instructions from this css file.

There is no need for php this way.

johannes ke├čler
Version: GnuPG v2.0.13 (GNU/Linux)


Re: emulate the browser print preview feature in php

I'd have suggested that solution as well. You'll avoid yourself lot of
work and server overload.

The blueprint css framework provides a native print css stylesheet
that you might give a look, it's a good start :)
(you can use it independently from the blueprint css, just grab a copy
of it)

http://blueprintcss.org /

Quoted text here. Click to load it

Site Timeline