473,664 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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*******@REMOV EMEyahoo.co.uk
[remove the obvious bits]
Feb 2 '06 #1
8 12769
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.infosystem s.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.infosystem s.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************ ************@ne ws.individual.n et>, dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infos ystems.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.demo n.co.uk/> TP/BP/Delphi/&c., FAQqy topics & links;
<URL:http://www.bancoems.co m/CompLangPascalD elphiMisc-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.dem on.co.uk>:
JRS: In article <MP************ ************@ne ws.individual.n et>, dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infos ystems.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************ ************@ne ws.individual.n et>, dated
Sat, 4 Feb 2006 20:16:17 remote, seen in news:comp.infos ystems.www.autho
ring.html, Stan Brown <th************ @fastmail.fm> posted :
Sat, 4 Feb 2006 19:14:29 +0000 from Dr John Stockton
<jr*@merlyn.de mon.co.uk>:
JRS: In article <MP************ ************@ne ws.individual.n et>, dated
Fri, 3 Feb 2006 11:46:11 remote, seen in news:comp.infos ystems.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 / ??*********@phy sics.org ©
Web <URL:http://www.merlyn.demo n.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.individu al.net...
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
12754
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 a list of values that are read as a JS array and used to populate the <option>s of a <select> in the calling page's form. Anyway, is there a way by which I can ensure, regardless of the user's browser settings, that the JS library is not used...
1
2976
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 using Antenna XSL formatter V3. This is what I have sofar: <fo:page-sequence master-reference="frame-pages" force-page- count="even"> <fo:flow flow-name="xsl-region-body">
18
10130
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 time, and B. A progress bar. 2. I have this working with a refresh timer: <META http-equiv="refresh" content="5">
10
23410
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? Thanks very much for your help! Fred
5
5453
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/>..."); aPage.Control.Add(lc) aPage.RenderControl(htmlWriter);
2
5293
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 tabs. the page load event happens beforre the tabs are loaded. Once the user mouseovers the tabs, the labels of the tabs appear, and stay there. it is irritating. i would like to force a mouseover so the tab names appear. thanks
2
2240
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) - 1180) +"; URL=index.aspx"); Once the initial page is loaded, i start pressing "F5" to refresh the page.
2
1563
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
1287
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 below the bottom of the page with FF. Is it possible to force the page to move down so that the returned info is visible without expecting the user to scroll down to find it?
1
1413
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 long report. I need to send the report to the different sites. I was able to do this in Access 2000 but am not able to get it to work in 2007.
0
8779
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7376
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6187
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4186
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1761
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.