Re:Subject: printing (might be OT)

From: Date: Thu, 23 Jan 2003 23:44:18 +0000
Subject: Re:Subject: printing (might be OT)
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-18060@lists.php.net to get a copy of this message
Sure Bobo - you can use Javascript to avoid the need to store your print file , together with CSS to format the page as you like. Javascript : onclick="window.print()" That will print the window (or offer a print dialog) in IE, NN4, Nav6, Moz, Opera etc etc. For print formatting in CSS look up @media print on www.w3c.org - something like this (may not be supported in NN4 btw - though it shouldnt print background colors of images if they are on a white background. In fact mostof this will be borked on netscape but hey :) Example : @media print {
        BODY {
        background : white;
        margin: 0.25in;
        size: 210mm 297mm landscape;
        /* or portrait */
        font-family: Georgia, "Times New Roman", Times, serif;
        font-size: 12pt;
        /* prefer to use points for print not pixels cause of resolution dependency */
        border : 1px solid #000000;
        float: left;
        }
        .hidden {
        display : none;
        }
Give your print hidden elements a style of .hidden as specified. There are also attributes for page-break-before and page-break-after and so on. Nest your other print-only styles inside the @media print{ } making sure that you duplicate most of the body styles in some print renderable way (at least, specify a font & weight) - the print styles wil be overridden by the normal (screen) styles specified in your stylesheet - no need to specify @media screen for these. Fool around for a while and you avoid PHP entirely. Use the force wisely, Luke :-) Cheers, Neil. At 16:16 23/01/2003 +0000, you wrote:
Message-ID: <001601c2c2c0$bba8dab0$9df81e0a@elstudion> From: "Bobo Wieland" <dev@elstudion.com> Hi! I'm sorry if this is OT but I really need an answer to this question and I can't find it anywhere... I have a link on a page that basicly should work as a print-button. When you click it, it should print some of the information that is currently displayed and ad a header and footer of some sort. The only way i know of doing this is using CSS and showing/hiding layers, but it would be much easier if I could generate a file of some sort that will be sent to the printer... Is there a way to do this sort of thing with php, or could you guys please help pointing me to some information about this...? thanks!


« previous php.windows (#18060) next »