I had recently upgraded the Crystal report runtime version from 13.0.1 to 13.0.8 to use the new feature of HTML interpretation of text.
I have the logic of printing crystal report as part of a WCF Service.
But we are now facing issues while we try to Print the report directly on a network printer using report.PrintToPrinter method saying printer not installed even though it was still installed and working.
when i tried to execute report.ExportToDisk method its sucesfully exporting it as a pdf file on to hard drive with new version 13.0.8
But when rolled back to an older version on CR runtime it started working fine.
Any clues on wat exactly could have caused the issue?
Thanks
In the application pool, set
Process Model Load User Profile: True
To avoid having the domain account or the user that setup the printers logged in.
I had a similar problem where a call to PrintToPrinter was working in development but failing in other environments. After tremendous heartache, I discovered that changing the PrintToPrinter call solved the problem. Hopefully this info will help others in the future.
This post from SAP forums lead me in the right direction:
https://answers.sap.com/questions/12380707/no-printers-are-installed---printtoprinter-problem.html
Changing from this:
crystalReport.PrintOptions.PrinterName = "\\\\print_server\\printer";
crystalReport.PrintToPrinter(1, true, 0, 0);
to this:
System.Drawing.Printing.PrinterSettings printersettings = new System.Drawing.Printing.PrinterSettings();
printersettings.PrinterName = PrinterToUse;
printersettings.Copies = 1;
printersettings.Collate = false;
Report.PrintToPrinter(printersettings, new System.Drawing.Printing.PageSettings(), false);
Related
I have a CrystalReportViewer control on an ASPX page. On my development machine the Crystal Report generates properly. However, when I publish it and run it on a web server I get the following pop-up screen. Entering in the password does nothing. The same screen just pops up again:
The datasource is configured in the .rpt file. So my code on the CrystalReportViewer is simply the following:
if (Request.QueryString["report"].ToString() != "")
{
ReportDocument doc = new ReportDocument();
doc.Load(Request.QueryString["report"].ToString());
CrystalReportViewer1.ReportSource = doc;
}
If it helps, some of the (more important looking) datasource properties in the .rpt file are as follows:
Database Type: ODBC (RDO)
DSN: plmprod
Server Type: ODBC - plmprod
Use DSN Default Properties: True
Also, I have the same ODBC/System DSN (named plmprod) setup on my development machine and on the web server. Using the "Test Connection" option they both test successfully.
I am not sure how to troubleshoot this issue. Nor do I know much about Crystal Reports.
What could be the problem that is causing the report to not generate on the web server?
I created a 64 bit ODBC/DSN on the web server and it now works!
All of my Crystal Reports Windows apps work fine around the company with 32 bit DSNs so I made a false assumption that is what the web server would want as well...not so as I found out.
I am trying to learn how to use the Telerik Reporting dll and i cannot find a single solid example that explains setup from start to finish for wanting to render a report that is located on an ssrs server. I am trying to set it up just like the normal windows reportviewer control( i know they're not the same). I have researched trying to set the server, report path, credentials, and so forth to simply connect and find the report to render but there is not one damn example...Can someone please share the secret to get this method working? The below code worked perfectly with the windows reportviewer control but i can't find an example for the telerik one that comes close to these properties for setup.
ServerReport serverReport = rvMain.ServerReport;
//User Credentials
System.Net.ICredentials credentials = System.Net.CredentialCache.DefaultCredentials;
ReportServerCredentials rptServerCrecentials = serverReport.ReportServerCredentials;
rptServerCrecentials.NetworkCredentials = credentials;
serverReport.ReportServerUrl = new Uri(report.ReportServer);
serverReport.ReportPath = report.ReportPath;
//EnableExportFormats(report.ExportTypes);
//Render the report
rvMain.RefreshReport();
Telerik Reporting does not support opening SSRS reports - this is the reason why you are having troubles. It can only open reports created with the Telerik report designers.
Cheers.
I'm having some issues getting crystal reports working nicely with our applications. And i cannot seem to find any resources that answer my question.
Basically, we have a crystal report, designed in the crystal reports application with it's own datasource.
Now when i add this to VS and display it, i need to setup a connection on the PC using MYSQL ODBC Datasource configuration tool, however even with this datasource setup, the crystalreports viewer askes for a password, and even suppling the correct password will show a "login failed. please try again" error message.
Ideally what i would like to know, is
A) is it possible and if so how, can i setup the connection in VS2010 so that i wont need to go around using MYSQL ODBC Datasource configuration tool on every PC i deploy my application too.
B) why does this connection always fail, the credentials are correct (we've tested multiple times, and the report & connection function perfectly from within crystal reports)
Hopefully you guys can help me out, my google fu has failed me.
If the Crystal Report allows for the username and password to the mySQL stored procedure to be passed to the report through the ReportViewer object, you have to use .NET code-behind to set the credentials via the:
ReportViewer.ServerReport.ReportServerCredentials
property of the ReportViewer instance.
Here's an example:
System.Net.NetworkCredential networkCredentials =
new System.Net.NetworkCredential("username", "password", "domain");
reportViewer.ServerReport.ReportServerCredentials = networkCredentials;
I am trying to print a document which is working fine in my Visual studio 2010 application but when i am publishing my project on IIS 7 then printing is not working and i cant see any error in the event viewer .
MyProcess = new Process();
MyProcess.StartInfo.CreateNoWindow = false;
MyProcess.StartInfo.Verb = "print";
MyProcess.StartInfo.FileName = destinationPath;
MyProcess.Start();
MyProcess.WaitForExit(10000);
MyProcess.Close();
When you're running in Visual Studio, you're running as a logged-in, interactive user.
When you're running in IIS, well, you're not any of the above.
The way this is normally done in a web application is to:
Display the document to the user in the browser
Print the document by using the 'window.print' function from JavaScript.
If anyone still cares for an answer..
I had the same problem, solution was to give IIS user access to use installed printers on the computer. When you print from IIS , you're logged in as a system default user who by default doesn't have proper printer access setup in the registry.You need to give printer access to the default system user by adding few entries in the registry. Just follow this tutorial like I did http://support.microsoft.com/?kbid=184291.
It will fix it.
If the printer is not installed on the server, nothing is going to happen.
If you're trying to print from ASP.NET code to a printer attached to the client computer it's never going to work. The server cannot get to and use any resources on the client computers.
2nd and important thing change to LoadUserProfile to true in IIS Application pool.
I'm trying to get a Crystal Report to show up on a web page. My code looks like this:
ReportDocument rd = new ReportDocument();
rd.Load(#"C:\projects\reports\testreport.rpt");
rd.SetDatabaseLogon("sa", "thepassword");
CRViewer.ReportSource = rd;
I've worked through several actual errors already to get to where I am now. The last error I had was that the connection couldn't be made, but when I added the SetDabaseLogon call to use SQL Server Auth security instead of integrated that problem was fixed.
Now I am not getting any error at all but the report simply doesn't show up.
I'm at a loss as to what to try now, any ideas would be appreciated!
(I don't know if this is really relevant or not, but this is in a SharePoint web part that I'm creating.)
Try adding this line:
CRViewer.Show();
If it isn't that simple, then I'd run the application outside of the webpart wrapping to at least confirm/deny if it being in SharePoint is related.