Hi,
I’m a newbie of this forum. I’ve encountered problem to manage the AS/400 device printer with .NET framework
I’ve created an application with composer to have a simple terminal on intranet, after I’ve enabled a printer and, using template for instant screen, I’ve tried to connect printer device to my run_printlet.aspx page.
The device seems to be connected, but no document was print.
Following my page “run_printlet.aspx”
<Register>
<Import>
<html>
<head>
<title>Printlet</title>
<script></script>
</head>
<body>
<a>Nascondi Stampante</a> |
<a>Refresh</a>
<form>
<!-- <gx> -->
<br>
<script>
Shared p As New GXPrinter
Protected Sub btnConferma_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim prnObj As GXPrintObject()
p.setApplication("OCS")
p.setServerURL("applinx://10.12.9.21:2323")
p.setApplicationParm(GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_NAME, txtPrinterDevice.Text)
'p.setApplicationParm(GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_TYPE, "IBM-3812-1")
p.setWaitCondition(GXPrinterSessionConstants.GX_WAIT_COND_PRINTER_READY, "", 0, 0, 0, 1000, 500)
If p.connect() <> 0 Then Response.Write("<br><b>ERRORE connect()</b><br>")
If p.attach() <> 0 Then Response.Write("<br><b>ERRORE attach()</b><br>")
Response.Write("<br>Stringa per cfg : " + GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_NAME)
Response.Write("<br><b>Device :</b>" + p.getApplicationParm(GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_NAME) + "<br>")
'Response.Write("<br>Printer Buffer Vuoto ? <b>" + prnObj.isEmpty().ToString() + "</b><br>")
'Response.Write("<br><b>Errore : " + prnObj.getErrorMessage.ToString() + "</b><br>")
Response.Write("<br>Device name impostato : " + p.getApplicationParm(GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_NAME))
Response.Write("<br>Device Type impostato : " + p.getApplicationParm(GXPrinterSessionConstants.GX_APPLICATION_PARM_DEVICE_TYPE))
Response.Write("<BR>Status : " + p.getPrinterStatus().ToString() + " - " + p.getErrorMessage().ToString() + "<br>")
'System.Threading.Thread.Sleep(5000) ' dovrei aspettare un poco circa 5 sec
'Response.Write("<br><b>HO ASPETTATO 5 SEC.</b><br>")
p.setWaitCondition(GXPrinterSessionConstants.GX_WAIT_COND_END_OF_PRINT, "", 0, 0, 0, 10000, 500)
'If prnObj Is Nothing Then Response.Write("<b><br>Oggetto GXPrinterObject vuoto !!")
'GXPrinterControl1.deviceName = txtPrinterDevice.Text
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim prnobj As GXPrintObject
p.setWaitCondition(GXPrinterSessionConstants.GX_WAIT_COND_PRINTER_READY, "", 0, 0, 0, 1000, 500)
prnobj = p.getPrint()
If prnobj Is Nothing Then
Response.Write("<b><BR>Oggetto prnObj Vuoto ! </b><Br>")
Else
Response.Write("<br>SeqNumber:" + prnobj.getSeqPrintNumber().ToString())
Response.Write(prnobj.getBuffer())
Response.Write("<br>Prelevato il file ? <br>")
Response.Write("<br> " + prnobj.isEmpty().ToString())
End If
End Sub
</script>
<br>
<asp></asp>
<asp>
<asp>
</form>
</body>
</html>
Probably is not correct but documentation is not so clear about method and class use.
Someone could help me to solve this problem ?
Many thanks.
PS: Applinx version 5.2.3.0029 - Windows Server 2003 R2 - IIS 6.0