To use the functionality of the SystemPrinter object, you must first add a reference to the ActiveReports.Interop.dll to your solution. Please note that this assembly is unmanaged, and therefore uses unsafe code and is not recommended for use in web projects.
[Visual Basic]
Dim i As Integer
Dim rpt As New rptEscape()
Dim m_myARPrinter As New DataDynamics.ActiveReports.Interop.SystemPrinter()
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Viewer1.Document = rpt.Document
rpt.Run()
Escape("&l 0H")
'your printer's escape sequence from printer documentation
End Sub
Private Sub Escape(ByVal code As String)
m_myARPrinter.StartJob("Test Printer")
m_myARPrinter.Graphics.PageUnit = GraphicsUnit.Pixel
Dim aPage As New DataDynamics.ActiveReports.Document.Page
Dim nCount As Integer
nCount = rpt.Document.Pages.Count
Dim rcPage as RectangleF
rcPage = RectangleF.Empty
For i = 0 To nCount - 1
m_myARPrinter.Escape(code)
m_myARPrinter.StartPage()
aPage = rpt.Document.Pages(i)
aPage.Units = DataDynamics.ActiveReports.Document.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
Keywords:
Applies To: ActiveReports for .NET 1.0
|