Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Howto print direcly to printer through ASp

Status
Not open for further replies.

AnNguyen

Programmer
Jul 18, 2002
33
US
Hello Crystal report expert.

I try this code from crystal report example, it does not preview the report but the CRviewre print window popups and i have to click print to do so which is useless id you need to print 10 reports one after another.

Try as i might, but i stuck in here, Do i have to set up the printer? or something that i miss or do not know? hopefully someone can help me out

Any help would be very appreciated and thanks in advance

And here is my codes

<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6>

<OBJECT ID=&quot;CRViewer&quot;
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
WIDTH=0% HEIGHT=0%
CODEBASE=&quot;/viewer/activeXViewer/activexviewer.cab#Version=2,2,4,37&quot;>
<PARAM NAME=&quot;EnableRefreshButton&quot; VALUE=0>
<PARAM NAME=&quot;EnableGroupTree&quot; VALUE=0>
<PARAM NAME=&quot;DisplayGroupTree&quot; VALUE=0>
<PARAM NAME=&quot;EnablePrintButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableExportButton&quot; VALUE=0>
<PARAM NAME=&quot;EnableDrillDown&quot; VALUE=0>
<PARAM NAME=&quot;EnableSearchControl&quot; VALUE=0>
<PARAM NAME=&quot;EnableAnimationControl&quot; VALUE=0>
<PARAM NAME=&quot;EnableZoomControl&quot; VALUE=0>
</OBJECT>



<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
dim timer
dim printerTimer
dim pageOne
PageOne = True
Sub window_onLoad()
Page_Initialize()
End Sub

Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject(&quot;WebReportBroker.WebReportBroker&quot;)
if ScriptEngineMajorVersion < 2 then
window.alert &quot;IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site.&quot;
CRViewer.ReportName = Location.Href
else
Dim webSource
Set webSource = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource.ReportSource = webBroker
webSource.URL = &quot; 'webSource.URL = &quot; webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub

Sub CRViewer_DownloadFinished(byval downloadType)
if downloadType = 1 and PageOne then
PageOne = False
timer = window.settimeout(&quot;OnMyTimeOut&quot;,1000)
end if
end sub

Sub OnMyTimeOut()

if not CRViewer.IsBusy then
window.ClearTimeout(timer)
'window.alert &quot;My timeout&quot;
CRViewer.PrintReport
printerTimer = window.SetTimeOut(&quot;OnPrinterTimeOut&quot;, 1000)

end if
end sub

Sub OnPrinterTimeOut()
if not CRViewer.IsBusy then
window.ClearTimeOut(printerTimer)
window.History.Back
end if
end sub





-->
</SCRIPT>

</BODY>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top