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

How to print Crystal reports from an asp page?

Status
Not open for further replies.

HuskerKeith

Programmer
Jan 28, 2003
8
0
0
US
Hello,

I need to print a report from an asp page, preferably without the user even seeing the report. Or, to allow some fields to be visible, but when printing only some of the fields print off.

Anyone have any ideas?

Thanks in advance
 
The inherent problem with this is that you want to print from a web page.

This is a security issue. Just imagine the ASP "virus" that prints 10 million pages to the user's printer.

As such, Microsoft makes it difficult to print from a web browser without the user explicitly doing so. That's why web pages generally don't have "print" buttons, just versions of documents that are formatted for printing.

We have this problem in that we use the Crystal DHTML viewer, but users want to be able to print the reports. It's a tricky issue, and one we don't have a good solution for.

-Tim
 
Thanks, Tim. It has occured to me that being able to access the user's printer from ASP code is kind of a dangerous thing, but I thought I had heard somewhere that it was possible.

My boss has this idea of what needs to be done. I'm ready to tell him this is the way it's going to be, but...

Anyway, I tried javascript:window.print(), and that printed a page with the print dialog box, but the page was blank--none of the report actually printed off, just a black frame around the outside. To print the contents of the frame, I still haven't figured out how to simulate the user clicking on the crystal viewer's print icon.
 
There is a method available in the ActiveX Viewer to print CRViewer.PrintReport.But this still would open up the print dialog box.
 
What is that method? That would work great, in nothing else. :)
 
hi arunrathna,

I've tried the method that you mentioned. But I can't invoke the printer dialog instead of viewer. How can I print the report directly?

Thanks in advance
Clara
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top