pageBreakBefore property

Defines whether a page break occurs before the object.

 

Syntax

Integer value = object.put_pageBreakBefore( v);Integer value = object.get_pageBreakBefore(* sBreak);

Property values

Type: BSTR

always (always)

Always insert a page break before the object.

auto (auto)

Default. Neither force nor forbid a page break before the object.

avoid (avoid)

Internet Explorer 8. Forbid a page break before the object, if possible.

empty string (empty string)

Behaves the same as auto.

inherit (inherit)

Internet Explorer 8. Inherit the value of the same property for the object's parent.

left (left)

Currently behaves the same as always.

right (right)

Currently behaves the same as always.

String format

auto | always | avoid | left | right | inherit

CSS information

Applies To All elements
Media visual
Inherited no
Initial Value none

Standards information

Remarks

This property applies when printing the document. This property does not apply to the br or hr elements.

If there are conflicts between the value of this property and the IHTMLCSSStyleDeclaration::pageBreakAfter property of the object previously displayed in the browser, the value that results in the largest number of page breaks is used.

Page breaks are not permitted inside positioned objects.

Examples

The following example uses the IHTMLCSSStyleDeclaration::pageBreakBefore property to start printing on a new page.

Setting IHTMLCSSStyleDeclaration::pageBreakBefore to always for the h3 element specifies that a page break occurs before each h3 heading.

Code example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/page-break-before.htm

<!DOCTYPE html>
<html>
<head>
   <style type="text/css">
      h3 {
         page-break-before: always;
      }
   </style>
</head>
<body>
   <p>Because page-break-before is set to always, there will be a page break before the following H3 title when you print this page.</p>
   <h3>Start New Section on New Page</h3>
</body>
</html>

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows 2000 Server

Header

Mshtml.h

IDL

Mshtml.idl

DLL

Mshtml.dll

See also

Reference

IHTMLCSSStyleDeclaration::pageBreakInside

IHTMLCSSStyleDeclaration::pageBreakAfter

Conceptual

CSS How-to - Optimize Pages for Printing Using CSS