Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Printing HTML pages

Posted on 2001-08-16
8
Medium Priority
?
355 Views
Last Modified: 2012-06-27
Is it possible to add something to an HTML document to force browser to brake this document into physical pages the way I would like to, e.g. specify where physical page should start and end?
0
Comment
Question by:davdonin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 2

Author Comment

by:davdonin
ID: 6392753
By saying "physical pages" I mean when the document is printed on a printer.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6392797
I IE only you can use this in the head:

<style>
   .breakhere {page-break-after:always}
</style>

Then where you want the break put in:

<span class="breakhere"> &nbsp;</span>

Does not work very effectively.  It will put in the break, but the
print may break a other places as well.

In Netscrap there is not way to put in a break.

If the format of the printing is critical do not use an HTML page.

Convert it to a printer friendly format like PDF or DOC.

Cd&
0
 
LVL 2

Author Comment

by:davdonin
ID: 6392876
I have IE, but this method does not work for me. Most likely I am doing something wrong as my knowledge of HTML is close to zero.

Here is my document:

<html>
<head>
<style>
   .breakhere {page-break-after:always}
</style>
</head>
<body>
<pre>
  1                                                     Customer No.        440010046                
  2                                             Invoice No.         143673                  
  3                                             Invoice Date        01-July-2001            
  4                                             Page                1/4
  5
  6
  7
  8
  9
 10
<hr>
<span class="breakhere"> &nbsp;</span>
  1                                                     Customer No.        440010046                
  2                                             Invoice No.         143673                  
  3                                             Invoice Date        01-July-2001            
  4                                             Page                2/4
  5                        ACCOUNT STATEMENT                        
  6
  7                                                                        EUR             #              
  8Total Amount now due on this invoice                                7,163.84        4,303.90
  9Payments outstanding on previous invoices including VAT               312.71          187.87
 10Balance Forward Including VAT                                       7,476.55        4,491.77
 11
 12EUR exchange rate 1.6645                                                        
<hr>
<span class="breakhere"> &nbsp;</span>
  1                                                     Customer No.        440010046                
  2                                             Invoice No.         143673                  
  3                                             Invoice Date        01-July-2001            
  4                                             Page                3/4
  5
  6
  7
  8
  9                                                                      
 10
</pre>
</body>
</html>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 19

Expert Comment

by:webwoman
ID: 6392939
You've got pre tags, your span only covers a space, and (as was mentioned before) it's not going to help much.

You don't control the paper size, orientation, font size (user can override anything you do), etc., etc., etc....

Set it up fine for you, it's wrong for anybody with a different printer, font size, system fonts, settings, etc. Which is probably 99%+ of the world... ;-)

Your BEST option for HTML is to put everything in a fixed size table, apprx. 500-600 px wide, no effects, no fancy font settings, no form fields, no background colors/images, no animations. That prints adequately (not perfectly) from just about everything.

But if it's important that it print a certain way, or if it's long, complex tables of data -- either make it a PDF or don't worry about how it prints.
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 150 total points
ID: 6393582
If you are going to use pre tags do the style this way and get rid of the spans:

<style>
  hr {page-break-after:always}
</style>
0
 

Expert Comment

by:webdude
ID: 6394545
I just stick the style in the table tag like so:

<table border=0 cellpadding=0 cellspacing=0 width=600 style="page-break-after:always">

cheers!
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6396736
Glad we could help.

Cd&
0
 
LVL 1

Expert Comment

by:magnakuz
ID: 6702524
Here is what I use.. It works very well:

<BR clear=all style='page-break-before'>

If you want to force a new page break even if it's the start of a new page you can use:

<BR clear=all style='page-break-before:always'>

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question