how to control printing of document with php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shaun112
Forum Newbie
Posts: 4
Joined: Fri Jul 04, 2008 5:38 am

how to control printing of document with php

Post by shaun112 »

is there a way of controing document printing with php :banghead: :banghead:


//i appreciate your replies but what i really want is (

select data from my database and after doing this, print out the information
roll by roll to an A4 paper. pleas i am still very much a beginer in php so pleas be very comprensive thanks in advance.
Last edited by shaun112 on Mon Jul 07, 2008 12:34 pm, edited 1 time in total.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: how to control printing of document with php

Post by jaoudestudios »

You can easily do it with CSS.

When you link to a CSS style sheet you need to specify a media type, options are...
all - Suitable for all devices
aural - Intended for speech synthesizers. See the section on aural style sheets for details.
braille - Intended for braille tactile feedback devices.
embossed - Intended for paged braille printers.
handheld - Intended for handheld devices (typically small screen, monochrome, limited bandwidth).
print - Intended for paged, opaque material and for documents viewed on screen in print preview mode. Please consult the section on paged media for information about formatting issues that are specific to paged media.
projection - Intended for projected presentations, for example projectors or print to transparencies. Please consult the section on paged media for information about formatting issues that are specific to paged media.
screen - Intended primarily for color computer screens.
tty - Intended for media using a fixed-pitch character grid, such as teletypes, terminals, or portable devices with limited display capabilities. Authors should not use pixel units with the "tty" media type.
tv - Intended for television-type devices (low resolution, color, limited-scrollability screens, sound available).

So just use the print option and code the CSS to how you want it to print, if at all, as you can do display none on the body and nothing will print.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: how to control printing of document with php

Post by onion2k »

Most CSS print options won't work on older browsers. If you need proper print control generate a PDF file.
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: how to control printing of document with php

Post by Ollie Saunders »

Most CSS print options won't work on older browsers. If you need proper print control generate a PDF file.
Ekkk!!. Besides it's loads more work and I'd like to encourage users with outdated browsers to upgrade them.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: how to control printing of document with php

Post by onion2k »

From your link - "PDF is great for one thing and one thing only: printing documents."

What's this thread about again Ollie?

:wink:
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Re: how to control printing of document with php

Post by Ollie Saunders »

OK. I'll take that. My disdain for PDFs spewed over a bit there.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: how to control printing of document with php

Post by Weirdan »

Moved to PHP-Code - the question has nothing to do with databases
Post Reply