Web Printing

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Web Printing

Post by icesolid »

I want to print out tickets one per page, I was just wondering what is the height in pixels that prints out on a printer, I tried making my td cell height=792 but that isent working.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Each printer/browser/OS whatever can be different. The bottom line is never rely on width/height to determine pages.

There is however a CSS attribute

Code: Select all

page-break-after:always;
page-break-before:always;
e.g.

Code: Select all

Page 1
<br style="page-break-before:always;">
Page 2
<br style="page-break-after:always;">
Page 3
Note: to view the output.. go to print preview
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

however, some browsers may not follow those directives. So alternates should be available, such as displaying it a page at a time for them to print, offering them a PDF of the tickets (dynamically generated), etc
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Thanks

Post by icesolid »

Well I tested this code in IE and it works great, thanks!

As far as other browsers go, I am not concerned about that because this site is for company useonly, and I know that all of their computers are running Windows XP with the latest IE.

Thanks again, a handy little bit of code!
Last edited by icesolid on Sun Feb 19, 2006 5:00 pm, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Seriously .. it's WAAAAAAAY too much hassle to get a browser to do this sort of thing. Generate a PDF file instead. It's considerably less effort in the long run and looks nicer too.
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

I Like It!

Post by icesolid »

I don't know about that...I found that code very easy to use and works in newer browsers such as Internet Explorer and Netscape 7.0 and up.

I'm not worried about Mozilla browsers (I haven’t tested) because I am SURE that none of the users of this site are going to be using that browser. This site will be running on desktops at the location and laptops offsite all running the latest Internet Explorer.

On top of that, its time for all of those old school computer junkies to update their browsers, get with the program yawl! I think that newer browsers are plenty safe for the average computer user and offer the ability to run the latest enhancements of the web.
MinDFreeZ
Forum Commoner
Posts: 58
Joined: Tue Feb 14, 2006 12:28 pm
Location: Lake Mary, FL

Post by MinDFreeZ »

u can also use alternate stylesheet or just a small section with media="print" and change some stuff in the css for when it's printed... never heard of that page-break thing.. sounds cool though :P
matthijs
DevNet Master
Posts: 3360
Joined: Thu Oct 06, 2005 3:57 pm

Post by matthijs »

I'm not worried about Mozilla browsers....

... its time for all of those old school computer junkies to update their browsers
i am deeply offended as a Mozilla 1.7.12 user!!! :wink:
Post Reply