Solved

Print and Page Break in IE7

Posted on 2007-11-14
9
1,068 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
Comment Utility
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
Comment Utility
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
Comment Utility
you will see the break if you do a print-preview...
0
 

Author Comment

by:bender007
Comment Utility
The page did not break at that point. It was just one continous page.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 14

Expert Comment

by:cezarF
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Forced accept.

Computer101
EE Admin
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now