Page breaks

M

MW de Jager

Hi

I'm programming in Delphi and use HTML for reporting and printing. Problem
is this. The HTML documents contain a varying number of tables, of
different sizes. The documents also may contain text that wraps around at
the end of line. When I try to print the HTML, the tables often end up
being broken over two pages. What can I do, to force Internet Explorer, to
print a table on the next page if it will not fit on the current page, when
it is being sent to the printer?

Any help wil be appreciated
MW
 
N

Nico Schuyt

MW said:
.. What can I do, to
force Internet Explorer, to print a table on the next page if it will
not fit on the current page, when it is being sent to the printer?

I'm affraid that is impossible. Maybe it's an improvement to add a page
break before the table:
table {page-break-before: always}
 
A

Andy Dingley

I'm programming in Delphi and use HTML for reporting and printing.
When I try to print the HTML, the tables often end up
being broken over two pages.

You have two avenues of approach, CSS and the page-break rules (sadly
poorly supported) and also you're generating the content from a
useful programming language. You can do some reasonable estimation of
page location for each row and then apply classes to relevant lines of
the output HTML to invoke CSS that strongly hints "page-break-after :
always" or "page-break-before : avoid"

You can also use a CSS media rule to set the font-size for printing in
points, rather than ems (as you'll be using on screen)

There will now be a flurry of posters to point out that you can't do
this in HTML, They're right of course, but this isn't HTML - it's HTML
intended for print. You know the page size (ignoring margins and US
letter paper) and you have a good probablility of knowing the text
size in points. Within this constraint of print targetting, then you
can certainly improve mattes.
 
A

Adrienne

Gazing into my crystal ball I observed Andy Dingley
You have two avenues of approach, CSS and the page-break rules (sadly
poorly supported) and also you're generating the content from a
useful programming language. You can do some reasonable estimation of
page location for each row and then apply classes to relevant lines of
the output HTML to invoke CSS that strongly hints "page-break-after :
always" or "page-break-before : avoid"

You can also use a CSS media rule to set the font-size for printing in
points, rather than ems (as you'll be using on screen)

There will now be a flurry of posters to point out that you can't do
this in HTML, They're right of course, but this isn't HTML - it's HTML
intended for print. You know the page size (ignoring margins and US
letter paper) and you have a good probablility of knowing the text
size in points. Within this constraint of print targetting, then you
can certainly improve mattes.

I would add to that, if you are using different margins or if you have
navigation, copyright, header information that you do not want printed,
this is what I do:

@media screen {
#nav {...}
#footer {...}
#copyright {...}
#content {margin-left:20%}
}
@media print {
#nav, #footer, #copyright {display:none}
#content {margin:0}
}
 
A

Andy Dingley

I would add to that, if you are using different margins or if you have
navigation, copyright, header information that you do not want printed,
this is what I do:

I do a lot of that too, but I tend to do it by putting "print-only"
and "no-print" classes onto the HTML. I do it for a major page
component like "nav-menu" of "advertising-banner" and such, but I
wouldn't do it for something smaller like "copyright". I might
sometimes want to print that, so I'd rather keep the specificity in
the HTML, rather than the CSS.

I'm also not that keen on using ids rather than classes for top-level
structure like "footer". An id has a high value in a CSS selector
compared to a class, and this makes it difficult to sub-class CSS
behaviour by applying another class to elements within it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top