A Runtime Callable Wrapper (RCW) is a special .NET proxy
class that allows
ASP.NET to use old COM components. If you would like to use
the aspPrint.dll
server component in ASP.NET, follow these steps:
1. In Visual Studio.NET, select Project
| Add Reference from the menu and then
select the COM tab to display a list of currently installed COM
objects
2. Double click aspPrint.dll in the listing. Visual Studio.NET will create two files
in the bin directory of your web application:
Interop.aspPrint.dll and
Interop.VBRUN.dll
3. You can now create an aspPrint.ServerPrint object and Visual Studio.NET's
IntelliSense will recognize all its properties and methods.
aspPrintTest.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="aspPrintTest.aspx.vb" Inherits="experiments.aspPrintTest"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>aspPrint Test</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<h1 style="FONT-FAMILY: Arial">aspPrint Test</h1>
<form id="Form1" method="post" runat="server">
<asp:Button id="cmdButton" style="Z-INDEX: 101; LEFT: 54px; POSITION: absolute; TOP: 171px" runat="server" Text="Execute aspPrint"></asp:Button>
</form>
</body>
</HTML>
aspPrintTest.aspx.vb
Public Class aspPrintTest
Inherits System.Web.UI.Page
Protected WithEvents cmdButton As System.Web.UI.WebControls.Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub cmdButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdButton.Click
Dim objP As New aspPrint.ServerPrint
objP.setPrinter = "Canon BJC-4300"
objP.setPaperSize = 1
objP.setOrientation = 1
objP.setColorMode = 1
' You must call setDocument after setting all the document properties
objP.setDocument()
objP.setForeColor = Microsoft.VisualBasic.RGB(0, 0, 0)
objP.setFont = "Courier"
objP.setFontSize = 14
objP.setFontBold = False
objP.setFontItalic = True
objP.setFontUnderline = False
' This lengthy line demonstrates the new word wrapping feature
Dim strText As String
strText = "Runtime Callable Wrapper (RCW) is a special .NET proxy class that sits between your code and the COM component."
objP.doPrint(strText)
' You must call endDocument when you are ready to print
objP.endDocument()
End Sub
End Class
|