Solved

Print and Page Break in IE7

Posted on 2007-11-14
9
1,074 Views
Last Modified: 2012-05-05
I use this code to insert page break in a HTML report that I dsiplay on a Webpage.However when i try to print it , it would have white space filled on the top and bottom portion of the text.

Eg:

 strReport = "<pre>" & vbCrLf
 strReport = strReport & "TEXT"
 strReport = strReport & "</pre>" & vbCrLf
 strReport = strReport & "<br style=""page-break-before:always"">" & vbCrLf
 strReport = strReport & "<pre>" & vbCrLf
 strReport = strReport & "TEXT2"
 strReport = strReport & "</pre>"
0
Comment
Question by:bender007
  • 4
  • 3
9 Comments
 
LVL 14

Expert Comment

by:cezarF
ID: 20286113
try without the <pre> tag

 'strReport = "<pre>" & vbCrLf
 strReport = strReport & "TEXT"
 'strReport = strReport & "</pre>" & vbCrLf
 strReport = strReport & "<br style=""page-break-before:always"">" & vbCrLf
 'strReport = strReport & "<pre>" & vbCrLf
 strReport = strReport & "TEXT2"
 'strReport = strReport & "</pre>"
0
 

Author Comment

by:bender007
ID: 20286436
Nope. That did not work. The page breaks did not take effect.
My original problem was ;some pages would be fine without any whitespaces but the first few would have whitespace at the top.
0
 
LVL 14

Expert Comment

by:cezarF
ID: 20286505
you will see the break if you do a print-preview...
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:bender007
ID: 20286569
The page did not break at that point. It was just one continous page.
0
 
LVL 14

Expert Comment

by:cezarF
ID: 20286633
this is what i did to test. print preview shows 2 pages. with the <pre> there's a white space on top of page 2
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>

<BODY>
 TEXT
 <br style="page-break-before:always">
 TEXT2
</BODY>
</HTML>
0
 

Author Comment

by:bender007
ID: 20290426
Removal of the <pre> tags results in my existing text loosing its formatting. The text I use has some HTML formatting .
0
 
LVL 14

Accepted Solution

by:
cezarF earned 500 total points
ID: 20294326
i changed the page-break to after. looks alright. nomore white space on the print preview.

<br style="page-break-after:always">
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20521806
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

828 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