cancel
Showing results for 
Search instead for 
Did you mean: 

Embedding Web Browser in a c# form disable Crystal Reports Print Control

Former Member
0 Kudos

Good morning

I am developing a c# com object for a client that embeds a Web Browser control that is populated with REST commands prepared in the com object. Using these rest commands I can browse the repository, find a report, check the ID etc etc. Once a report is identified, I call the generation with the Crystal Report OpenDocument, passing parameters etc, and everything is working fine.

Everything except a detail: when I push the print button on the viewer, the system just display a waiting window with the message:

Please wait while the Crystal Reports Print Constrol is loaded

(see attachment)

and the animation does not stop anymore. No error, no ping-out. Just a never-ending animation that, in my opinion, is trying to activate the Pring Control ActiveX without success.

It looks like a missing authorization to run activex, but the web control does not seems to have such properties.

I am asking if somebody else is trying to pilot the viewer with REST API Commands and have found the same issue and may be a solution, I am interested to know.

PS: I can setup the report to generate a PDF preview but the client would prefer to have the Print Dialog at first. In any case, the previre printing is working without problems.

Thank you for any help on this very odd issue.

Angelo

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hello

I have found a solution to the described problem. It is not a "real" solution rather a workaround that fits my needs.

I was using a Web Browser Control placed on a standard C# form. I then passed to that web control the URL with OpenDocument with something like this:

CrystalReportForm iWin = new CrystalReportForm();

iWin.WebBrowser.ScriptErrorsSuppressed = true;

iWin.WebBrowser.Navigate(finalUrl);

iWin.Show();

Where finalURL contains the generated URL for the REST call OpenDocument.

I have changed strategy. Instead of embedding the Web Browser, I just open an indipendent web browser from c# with the command:

System.Type oType = System.Type.GetTypeFromProgID("InternetExplorer.Application");

object o = System.Activator.CreateInstance(oType);

o.GetType().InvokeMember("Navigate", System.Reflection.BindingFlags.InvokeMethod, null, o, new object[] { finalUrl });

The COM object then open and indipendent Internet Explorer window with the address of my OpenDocument  URL.

Hope this can be of help

Regards

Answers (0)