ActiveReports 6 Online Help
EndPage Method
Example 

Ends a specific page in a SystemPrinter print job initialized by the StartPage method.
Syntax
'Declaration
 
Public Sub EndPage() 
public void EndPage()
Example
using DataDynamics.ActiveReports.Interop;  
  
rpt rpt = new rpt();  
private void Form1_Load(object sender, System.EventArgs e)  
{  
    rpt.Run();  
    this.viewer1.Document = rpt.Document;  
    arPrint();  
}  
  
private void arPrint()  
{  
    DataDynamics.ActiveReports.Document.Page aPage = new DataDynamics.ActiveReports.Document.Page();   
    DataDynamics.ActiveReports.Interop.SystemPrinter m_myARPrinter = new DataDynamics.ActiveReports.Interop.SystemPrinter();       
    m_myARPrinter.StartJob("Test Printer"); //Replace "Test Printer" with the name of your printer  
    System.Drawing.RectangleF recPage = RectangleF.Empty;  
    int nCount = rpt.Document.Pages.Count;       
    m_myARPrinter.StartPage();       
    for(int i=0; i < nCount; i++)       
    {           
        aPage = rpt.Document.Pages[i];           
        m_myARPrinter.Graphics.PageUnit = System.Drawing.GraphicsUnit.Pixel;  
        aPage.Units = DataDynamics.ActiveReports.Document.Units.Pixels;  
        recPage.Width = aPage.Width;  
        recPage.Height = aPage.Height;  
        aPage.Draw(m_myARPrinter.Graphics, recPage);  
        m_myARPrinter.EndPage();  
    }       
               
    m_myARPrinter.EndJob();   
}
Imports DataDynamics.ActiveReports.Interop

Dim rpt As New rpt()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    rpt.Run()
    Me.Viewer1.Document = rpt.Document
    arPrint()
End Sub

Private Sub arPrint()
    Dim aPage As New DataDynamics.ActiveReports.Document.Page()
    Dim m_myARPrinter As New DataDynamics.ActiveReports.Interop.SystemPrinter()
    m_myARPrinter.StartJob("Test Printer") 'Replace "Test Printer" with the name of your printer
    Dim recPage As New System.Drawing.RectangleF()
    Dim nCount As Integer = rpt.Document.Pages.Count
    m_myARPrinter.StartPage()
    For i As Integer = 0 To nCount - 1
        aPage = rpt.Document.Pages(i)
        m_myARPrinter.Graphics.PageUnit = System.Drawing.GraphicsUnit.Pixel
        aPage.Units = DataDynamics.ActiveReports.Document.Units.Pixels
        recPage.Width = aPage.Width
        recPage.Height = aPage.Height
        aPage.Draw(m_myARPrinter.Graphics, recPage)
        m_myArPrinter.EndPage()
    Next

        m_myARPrinter.EndJob()
End Sub
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

SystemPrinter Class
SystemPrinter Members

Send Feedback