Print and Page Break in IE7

Posted on 2007-11-14
Medium Priority
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.


 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>"
Question by:bender007
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
  • 4
  • 3
LVL 14

Expert Comment

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>"

Author Comment

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.
LVL 14

Expert Comment

ID: 20286505
you will see the break if you do a print-preview...
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

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

Expert Comment

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">
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">

 <br style="page-break-before:always">

Author Comment

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

Accepted Solution

cezarF earned 2000 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">

Expert Comment

ID: 20521806
Forced accept.

EE Admin

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

771 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