ActiveReports 8
Escape Method
See Also  Example
GrapeCity.ActiveReports.v8 Assembly > GrapeCity.ActiveReports Namespace > SystemPrinter Class : Escape Method

code
The escape code being entered.

Glossary Item Box

Allows escape codes to be entered.

Syntax

Visual Basic (Declaration) 
Public Sub Escape( _
   ByVal code As System.String _
) 
C# 
public void Escape( 
   System.string code
)

Parameters

code
The escape code being entered.

Remarks

Escape codes are specific to the printer being used. For a list of escape codes, see the documentation for the printer.

Example

C#Copy Code
private void Form1_Load(object sender, System.EventArgs e)
{
    if((openFileDialog1.ShowDialog(this) == DialogResult.OK))
    {
        this.viewer1.Document.Password = "Test";
        viewer1.Document.Load(openFileDialog1.OpenFile());
        Escape("&1 OH"); //page eject code for certain printer (see manual for printer's sequences)
    }
}

public void Escape(string code)
{
    //code is the escape sequence from the printer's manual
    m_myARPrinter.StartJob("Test Printer");
    m_myARPrinter.Graphics.PageUnit = GraphicsUnit.Pixel;

    GrapeCity.ActiveReports.Document.Section.Page aPage;
    int nCount;
    nCount = this.viewer1.Document.Pages.Count;
    RectangleF rcPage;
    rcPage = RectangleF.Empty;
    for (int i = 0; i <= nCount - 1; i++)
    {
        m_myARPrinter.Escape(code);
        m_myARPrinter.StartPage();
        aPage = viewer1.Document.Pages[i];
        aPage.Units = GrapeCity.ActiveReports.Document.Section.Units.Pixels;
        rcPage.Width = aPage.Width;
        rcPage.Height = aPage.Height;
        aPage.Draw(m_myARPrinter.Graphics, rcPage);
        m_myARPrinter.EndPage();
    }
    m_myARPrinter.EndJob();
}
Visual BasicCopy Code
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    If (OpenFileDialog.ShowDialog(Me) = DialogResult.OK) Then
        Viewer1.Document.Password = "Test"
        Viewer1.Document.Load(OpenFileDialog.OpenFile())
        Escape("&l  0H") 'page eject code for certain printer (see manual for printer's sequences)
    End If
End Sub

Public Sub Escape(ByVal code As String) 'code is the escape sequence from the printer's manual
    m_myARPrinter.StartJob("Test Printer")
    m_myARPrinter.Graphics.PageUnit = GraphicsUnit.Pixel

    Dim aPage As GrapeCity.ActiveReports.Document.Section.Page
    Dim nCount As Integer
    nCount = Viewer1.Document.Pages.Count
    Dim rcPage As RectangleF
    rcPage = RectangleF.Empty
    For int i = 0 To nCount - 1
        m_myARPrinter.Escape(code)
        m_myARPrinter.StartPage()
        aPage = Viewer1.Document.Pages(i)
        aPage.Units = GrapeCity.ActiveReports.Document.Section.Units.Pixels
        rcPage.Width = aPage.Width
        rcPage.Height = aPage.Height
        aPage.Draw(m_myARPrinter.Graphics, rcPage)
        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