A newer version of this page is available. Switch to the current version.

PrintingSystemBase.InsertPageBreak(Single) Method

Inserts a page break at a specified position.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v18.2.Core.dll

Declaration

public void InsertPageBreak(
    float pos
)
Public Sub InsertPageBreak(
    pos As Single
)

Parameters

Name Type Description
pos Single

A Single value which specified the position to insert a page break.

Remarks

A page break must be inserted between two bricks. The pos parameter value must be the next coordinate value after the lowest coordinate of the brick preceding the page break.

Examples

This example demonstrates how to insert a page break between two bricks in a document. To accomplish this task, the PrintingSystemBase.InsertPageBreak method should be used, as demonstrated in the code snippet below.

NOTE

For this example to work correctly, you should add the PrintingSystem component (named printingSystem1) to your project, prior to executing this code.

The following two images demonstrate a document's apperance before and after page break insertion.

Examples.InsertPAgeBreak before insert

Examples.InsertPAgeBreak after insert

using System.Drawing;
using DevExpress.XtraPrinting;
// ...

private void button1_Click(object sender, EventArgs e) {
    // Start report generation.
    printingSystem1.Begin();

    // Obtain the Printing System's graphics.
    BrickGraphics gr = printingSystem1.Graph;

    // Specify graphics settings.
    gr.Modifier = BrickModifier.Detail;
    gr.BackColor = Color.FromArgb(26, 26, 154);
    gr.BorderColor = Color.FromArgb(254, 202, 2);

    // Insert a text brick.
    string s = "XtraPrinting Library";
    TextBrick textBrick = new TextBrick();
    textBrick = gr.DrawString(s, Color.FromArgb(67, 145, 252),
        new RectangleF(0, 0, 286, 80), BorderSide.All);
    textBrick.Font = new Font("Arial", 20, FontStyle.Bold | FontStyle.Italic);
    BrickStringFormat bsf = new BrickStringFormat(StringAlignment.Center,
        StringAlignment.Center);
    textBrick.StringFormat = bsf;

    // Insert a page break.
    printingSystem1.InsertPageBreak(81);

    // Insert an image brick.
    Image img = Image.FromFile(@"..\..\Data\logo.png");
    ImageBrick imageBrick = new ImageBrick();
    imageBrick = gr.DrawImage(img, new RectangleF(0, 81, 286, 81));

    // Finish report generation.
    printingSystem1.End();

    // Display the Print Preview form.
    printingSystem1.PreviewFormEx.Show();
}
See Also