473,326 Members | 2,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Force Page-break when printing

CJM
What is the best way to force a page break when printing from a browser?

A page in my application generates a series of tables which are usually less
than will fit on a page of A4. Ideally I want to introduce a page break
between each table when printing.

I'm not sure what options I have available. I know there is some support in
CSS but I'm no sure on the details or effectiveness.

Thanks in advance...

Chris

--
cj*******@REMOVEMEyahoo.co.uk
[remove the obvious bits]
Feb 2 '06 #1
8 12716
Thu, 2 Feb 2006 16:44:01 -0000 from CJM <cjmnew04
@REMOVEMEyahoo.co.uk>:
What is the best way to force a page break when printing from a browser?
You'll hear a chorus of people telling you you can't "force"
anything. They're right: the best you can do is _suggest_.
A page in my application generates a series of tables which are usually less
than will fit on a page of A4.
A4? What's A4? Yes, _I_ know what A4 is, but browsers can print to
many different paper sizes. You should not, repeat _not_, try to set
up your pages to print to any particular paper size if you're putting
them on the _World_ Wide Web.
Ideally I want to introduce a page break
between each table when printing.
I suppose you mean "between tables". That's a bad idea -- see above.
Any decent browser will try to keep a table on the same page if it
can do it. You can help browsers by putting your header row (if any)
in <thead>...</thead> and similarly for your footer row. Then if the
table is too big for a page -- and remember that you _do_not_know_
the page size -- a good browser will repeat the header and footer as
needed.
I'm not sure what options I have available. I know there is some support in
CSS but I'm no sure on the details or effectiveness.


Look in the CSS spec for page-break-before. Browser support is less
than perfect, but as I explained above you should not be using this
anyway for the application you mention.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Feb 2 '06 #2
Followup-to set: comp.infosystems.www.authoring.stylesheets

CJM wrote :
What is the best way to force a page break when printing from a browser?

A page in my application generates a series of tables which are usually less
than will fit on a page of A4. Ideally I want to introduce a page break
between each table when printing.

table
{
page-break-before: always;
page-break-inside: avoid;
}

http://www.w3.org/TR/CSS21/page.html...e-break-before

http://www.w3.org/TR/CSS21/page.html...e-break-inside

I'm not sure what options I have available. I know there is some support in
CSS but I'm no sure on the details or effectiveness.


It's not widely or well implemented. Except maybe Opera 8+

Followup-to set: comp.infosystems.www.authoring.stylesheets

Gérard
--
remove blah to email me
Feb 2 '06 #3
CJM
The only HTML suggestion I've seen so far was to add a host of <br> tags to
approximate a page... erm... no, thanks.

I've successfully implemented a fixed sized table (32 rows) with
page-break-before:always and it works pretty well.

Stan, I *can* guarrantee A4 size... this is for an intranet application, so
I do know what my target users will be using. However, I take your point
about these issues when dealing with the WWW,

I'd read about the woeful support for page-break-inside:avoid, so I didnt
bother investigating this avenue, bearing mind that I already had discovered
a reasonable solution.

Thanks

Chris
Feb 3 '06 #4
Fri, 3 Feb 2006 16:00:56 -0000 from CJM <cjmnew04
@REMOVEMEyahoo.co.uk>:
Stan, I *can* guarrantee A4 size... this is for an intranet application, so
I do know what my target users will be using.


Oh -- it might have been nice if you'd disclosed that up front when
asking your question on a World Wide Web forum.

But if you're concerned about printing, the right answer is to
distribute something that is page oriented, such as PDF. HTML ain't
it.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Feb 3 '06 #5
JRS: In article <MP************************@news.individual.net> , dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infosystems.www.autho
ring.html, Stan Brown <th************@fastmail.fm> posted :
Fri, 3 Feb 2006 16:00:56 -0000 from CJM <cjmnew04
@REMOVEMEyahoo.co.uk>:
Stan, I *can* guarrantee A4 size... this is for an intranet application, so
I do know what my target users will be using.


Oh -- it might have been nice if you'd disclosed that up front when
asking your question on a World Wide Web forum.


He posts with a UK address; it's obvious to any non-American that,
world-wide, A4 is much more common than the similar Imperial size.

You people really should realise, and then remember, that in most
respects your country is in a minority of about 1.5 to (N-1.5), where
there are N countries in the world.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Delphi 3 Turnpike 4 ©
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.com/CompLangPascalDelphiMisc-MiniFAQ.htm> clpdmFAQ;
<URL:http://www.borland.com/newsgroups/guide.html> news:borland.* Guidelines
Feb 4 '06 #6
Sat, 4 Feb 2006 19:14:29 +0000 from Dr John Stockton
<jr*@merlyn.demon.co.uk>:
JRS: In article <MP************************@news.individual.net> , dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infosystems.www.autho
ring.html, Stan Brown <th************@fastmail.fm> posted :
Fri, 3 Feb 2006 16:00:56 -0000 from CJM <cjmnew04
@REMOVEMEyahoo.co.uk>:
Stan, I *can* guarrantee A4 size... this is for an intranet application, so
I do know what my target users will be using.


Oh -- it might have been nice if you'd disclosed that up front when
asking your question on a World Wide Web forum.


He posts with a UK address; it's obvious to any non-American that,
world-wide, A4 is much more common than the similar Imperial size.


Well, of course. But that's completely irrelevant to my point, as
would be obvious if you hadn't snipped essential context.

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
HTML 4.01 spec: http://www.w3.org/TR/html401/
validator: http://validator.w3.org/
CSS 2.1 spec: http://www.w3.org/TR/CSS21/
validator: http://jigsaw.w3.org/css-validator/
Why We Won't Help You:
http://diveintomark.org/archives/200..._wont_help_you
Feb 5 '06 #7
JRS: In article <MP************************@news.individual.net> , dated
Sat, 4 Feb 2006 20:16:17 remote, seen in news:comp.infosystems.www.autho
ring.html, Stan Brown <th************@fastmail.fm> posted :
Sat, 4 Feb 2006 19:14:29 +0000 from Dr John Stockton
<jr*@merlyn.demon.co.uk>:
JRS: In article <MP************************@news.individual.net> , dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infosystems.www.autho
ring.html, Stan Brown <th************@fastmail.fm> posted :
>Fri, 3 Feb 2006 16:00:56 -0000 from CJM <cjmnew04
>@REMOVEMEyahoo.co.uk>:
>> Stan, I *can* guarrantee A4 size... this is for an intranet application, so
>> I do know what my target users will be using.
>
>Oh -- it might have been nice if you'd disclosed that up front when
>asking your question on a World Wide Web forum.


He posts with a UK address; it's obvious to any non-American that,
world-wide, A4 is much more common than the similar Imperial size.


Well, of course. But that's completely irrelevant to my point, as
would be obvious if you hadn't snipped essential context.


If I had wished to comment on the other part of your article, I would
have quoted from it. If the part I quoted was not thought worth
considering, then it should not have been posted.

On the World-Wide Web, the use of World Standard measurements is what
should be presumed. Few non-Americans choose to use Imperial sizes for
anything technical nowadays. World standards are metric, except in
fields where consistency is more important than rationality.

It's amusing, though, that the two most commonly-uses types of paper
here in the UK, though probably metric, don't seem to be A/B/C sizes.

--
© John Stockton, Surrey, UK. *@merlyn.demon.co.uk / ??*********@physics.org ©
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Correct <= 4-line sig. separator as above, a line precisely "-- " (SoRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SoRFC1036)
Feb 5 '06 #8
CJM

"Stan Brown" <th************@fastmail.fm> wrote in message
news:MP************************@news.individual.ne t...
Oh -- it might have been nice if you'd disclosed that up front when
asking your question on a World Wide Web forum.

If it was relevant to my question, I would have stated it. It wasn't - you
suggest the point at which you want a page-break in the pages and it works
the same whether or not the pages are accessible from the WWW or not.

The issue about unknown page sizes are equally relevant on intranets if you
can't guarrantee that the user will use a particular page size. In my case I
know that all my users use A4.
But if you're concerned about printing, the right answer is to
distribute something that is page oriented, such as PDF. HTML ain't
it.


Funnily enough, the PDF component we have renders an ASP page as a PDF. Page
breaking is controlled the same way in the PDF engine as it is on paper -
that is, I'd use this same CSS technique to inject breaks.
Feb 6 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Mark Anderson | last post by:
Sorry if this is borderline JS vs. HTML. I ask here as the success/failure if the resulting JS is key. I've a small external .JS library that allows a non code-savvy user to occasionally update...
1
by: Michel | last post by:
Hi all, This is my first post, so I am very new at this. I am trying to use page-number-citation twice in my code, but the second time it just shows '0'. The output is in pdf format and I am...
18
by: Alan Z. Scharf | last post by:
1. I have a chain of six asynch callbacks initiated by a button, and want the page to refresh at the end of each callback to display A. Results of a SQLServer query showing cumulative running...
10
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? ...
5
by: Piotr Strycharz | last post by:
Hi I want to render a page in memory. That is (pseudo-code): Page aPage = new Page(); LiteralControl lc = new LiteralControl("<form runat=server><asp:Label id=label Runat=server/>...");...
2
by: cottonj | last post by:
is there anyway to force an event, like mouseover? I have a page that loads, and due to some complex js code (not mine) it fails to write labels to tabs until the user does a mouseover on the...
2
by: Astrix | last post by:
Hi, I am working on a problem w.r.t session.timeout I have a code to redirect to this new page after 20 seconds. Response.AppendHeader("Refresh", Convert.ToString((Session.Timeout * 60) -...
2
by: Taftheman | last post by:
Hi, i have a problem forceing page breaks in word via a vb6 application i have the following code but it does not seem to like it , can any body help .Tables(1).Split.AllowPageBreaks = True
2
by: Geoff Cox | last post by:
Hello I have a <divin which the returned AJAX info appears but IE and FF seem to deal with it differently. IE at the moment places it to the right of a set of other <div>s whilst it is just...
1
by: Sharon Brennan | last post by:
I would like to divide my report by our departments and then sites. I've gone into properties for each of my sorts and put in page breaks but nothing happens. Everything just runs together on one...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.