Re: Print preview in php [message #174252 is a reply to message #174233] |
Sat, 28 May 2011 13:12 |
Robert Heller
Messages: 60 Registered: December 2010
Karma:
|
Member |
|
|
At Sat, 28 May 2011 02:05:04 -0700 (PDT) Co <vonclausowitz(at)gmail(dot)com> wrote:
>
> On 28 mei, 04:46, Robert Heller <hel...@deepsoft.com> wrote:
>> At Fri, 27 May 2011 21:24:36 -0400 Jerry Stuckle <jstuck...@attglobal.net=
>> wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> On 5/27/2011 5:48 PM, Co wrote:
>>>> Hi All,
>>
>>>> I was wondering if someone can help me with a code to preview part of
>>>> a php page
>>>> and eventually print it.
>>>> I don't want to print all of the page with images etc, just the data
>>>> within a certain area of the page.
>>
>>>> Anyone know if this is possible?
>>
>>>> Regards
>>>> Marco
>>
>>> =A0From a web page? =A0Not possible. =A0PHP runs on the server and has =
> nothing
>>> to do with page layout (that's HTML/CSS). =A0Print preview runs on the
>>> client and is dependent on client settings, of which PHP has no knowled=
> ge.
>>
>> OTOH, if the web page in question is being served by the PHP code, all
>> you need to do is create a link, something like this:
>>
>> <a href=3D"/ServeThePrinterFriendlyPage.php?..." target=3D"_blank"
>> onclick=3D"window.open(this.href,'win2','status=3Dno,toolbar=3Dno,scrollb=
> ars=3Dyes,titlebar=3Dno,menubar=3Dno,resizable=3Dyes,width=3D640,height=3D4 =
> 80,directories=3Dno,location=3Dno');
>> return false;" rel=3D"nofollow">Print This</a>
>>
>> And then the ServeThePrinterFriendlyPage.php file would then serve the
>> page without the special effects that make sense on the screen (eg
>> images, flash, ads, etc.) but don't on the printer. =A0The
>> target=3D"_blank" attribute handles the case where JavaScript is not
>> available and the onclick attribute handles the case where JavaScript
>> is available. =A0On the page served, you need to include a link like:
>>
>> <a href=3D"#" onclick=3D"window.print();return false;">Print</a> and
>> optionally one like <a href=3D"#" onclick=3D"window.close();return
>> false;">Close</a>. The first is a button to print the page and the
>> second is a button to close the popup window.
>>
>>
>>
>> --
>> Robert Heller =A0 =A0 =A0 =A0 =A0 =A0 -- 978-544-6933 / hel...@deepsoft.c=
> om
>> Deepwoods Software =A0 =A0 =A0 =A0--http://www.deepsoft.com/
>> () =A0ascii ribbon campaign -- against html e-mail
>> /\ =A0www.asciiribbon.org=A0 -- against proprietary attachments
>
> what should there be in the ServeThePrinterFriendlyPage.php?
> Is that the same as in the normal page but without images etc?
Yes. Probably also without stuff like sidebars, menus, and extanious
navigation features -- just the basic printable content.
>
> Marco
>
--
Robert Heller -- 978-544-6933 / heller(at)deepsoft(dot)com
Deepwoods Software -- http://www.deepsoft.com/
() ascii ribbon campaign -- against html e-mail
/\ www.asciiribbon.org -- against proprietary attachments
|
|
|