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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically printing CryRep 8 using CRViewer over Web

Status
Not open for further replies.

lax27

Programmer
May 23, 2001
3
0
0
US
I am trying to print reports over the Web (client side) using the CRViewer control. I can view the report using the standard code:

Sub window_onLoad()
Page_Initialize()
End Sub

Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
if err.number <> 0 then
window.alert &quot;The Seagate Software ActiveX Viewer is unable to create it's resource objects. To rectify this problem, please install Internet Explorer 4.0 or install DCOM for Windows 95 and the latest Microsoft Scripting Engine. These files are available at Microsoft's web site.&quot;
CRViewer.ReportName = &quot; else
Dim webSource0
Set webSource0 = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource0.ReportSource = webBroker
'Make Certain that the
webSource0.URL = &quot; webSource0.PromptOnRefresh = True
CRViewer.ReportSource = webSource0
end if
CRViewer.ViewReport
End Sub

But I can't just print it using &quot;CRViewer.PrintReport&quot; in place of &quot;CRViewer.ViewReport&quot;. Using &quot;CRViewer.PrintReport&quot; brings up the Report same as &quot;CRViewer.ViewReport&quot; does.

Ideally I don't even want the viewer to display anything I just want the reports to start print as soon as the previous page makes it's Request.

Chris Schaller
NIT, Inc
 
Even I am trying the same as above..
trying to print without previewing the CRViewer...
.printreport method is not printing directly.
what is the solution for this.

Vijay
 
Hello chris
I found the solution for this
use websource0.printout instead of
CRViewer.print report.

i hope this helps

Vijay
 
well, using hte CRViewer exactly in a similar mannner as u guys have been using it, when my report page shows up ther is absolutely NOTHING on it.

Can anyone please tell me what i am doing wrong ???

Thanks,


 
Justmeccv, If you use the code from the very first post with &quot;CRViewer.ViewReport&quot; as the very last line you should see something.

I have not been able to get my reports to print without clicking the printer icon on the CR viewer. Using the websource0.printout method did not work for me. I tried every variation that I could think of and nothing.

Some variations of using websource0.printout produced the CRViewer just as it had been diplayed before and some produce a blank report page. Either way I still can't get the reports to print only without having the report page displayed.
 
i don't see how websource.printout will work. i have never got it to work.

Can anyone help as the printout method would be helpful. i want to use this method client side and have not figured out how to do so, so far.
 
Try this code.

it works for me

<html>
<head>
<TITLE>Reports</TITLE>
</head>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript topmargin=0 leftmargin=0>
<OBJECT ID=&quot;CRViewer&quot;
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
WIDTH=0% HEIGHT=0%

CODEBASE=&quot;../../OBJECTS/activexviewer.cab#Version=8,5,0,217&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 err.number <> 0 then
window.alert &quot;The Crystal ActiveX Viewer is unable to create it's resource objects.&quot;
CRViewer.ReportName = &quot;/Reports/705.rpt&quot;
else
Dim webSource0
Set webSource0 = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource0.ReportSource = webBroker
webSource0.URL = &quot;/Reports/705.rpt&quot;
webSource0.PromptOnRefresh = True
webSource0.AddParameter &quot;password0&quot;, &quot;pass&quot;
webSource0.AddParameter &quot;user0&quot;, &quot;user&quot;
webSource0.AddParameter &quot;Prompt0&quot;, &quot;80&quot;
webSource0.AddParameter &quot;Prompt1&quot;, &quot;200203&quot;
CRViewer.ReportSource = webSource0

end if

CRViewer.ViewReport
End Sub


Sub CRViewer_DownloadFinished(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>
 
Hi jokecy

i tried your code and a blank page comes up..

have you included any setting or special pages on you web project?

thanks

speedny
 
Hi jokecy
Thats cool its really works..
Thanks a lot
Rakesh
 
Hi i am using code provided by jokecy. When loaded a page it was showing an error messge &quot;object does not support this property or method and didn't invoke printer for printing report displayed.

I am using IE 6.0. What is that method/Property which can't be supported by IE6.0 from code by jokecy?

Appriciate help on this.

Thanks,
Rama Kommineni
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top