Hi there,
I have done hours of searching on the net and ended up here. I am developing a web app that will be calling a Crystal Report that will not be visible to the client, it will just call it behind the scenes and send it right to the printer. This works great on my local development environment however when I place it on the web server, it hangs because I believe it is attempting to print to the web server's printers (which there are none).
Is there a work around to this? Can anyone shed light as to how they were able to get past this? I would really appreciate it!
Thanks,
Natalie
Request clarification before answering.
I suspect you are correct. If the report is not visible, how do you select the printer to print to?
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The requirement for the project I am working on is for a label printing system, the user basically clicks on a web page I created that looks like a huge sheet of avery labels and selects the starting label....that's all they want to see. The requirement calls for no installation of any software/hardware for this project so we can't install anything on the store computers. Once they select the label it needs to print to the printer which is a USB, non network printer, hooked up to the back office computer at each store.
Right. But how is the report to know what printer to print to?
Somewhere you have to specify the printer(?).
Two resources you will need to look at:
1) Code for selecting a printer. Unfortunately I don't know what version of CR you are using (let me know) as if you are using a "full build" of CR, I'd recommend using the InProc RAS Print Output Controller. If not, then plain jane CR APIs will have to do
2) The MS KBase re. System printers; [COM objects fail to print when called from ASP|http://support.microsoft.com/kb/184291/en-us]
- Ludek
I was hoping it would use the default printer selected on the client side which is only one printer per store, that is all they have and will ever have.
We are using Crystal Reports Enterprise 10
I haven't heard of the InProc RAS Print Output controller, any samples you may have would rock....I am completely new to doing any printing with this...
I have a quasi funky work around where I am just exporting the Crystal Report quickly to a PDF and saving it then re-opening it quickly for the client and then they can print it fron Adobe and all is well, except Adobe appears to change the label layout and screws with the margins and everything....ugh
Crystal Reports Enterprise 10 ?
Can you post the code you are using? Oh, and verin of .NET?
And BTW., the report will not use the default printer on the user's computer. It will use the default printer on the server. Once again thing to think about; how would the report know who the user is?
- Ludek
I guess in a nutshell that is my question....how can I tell it to programatically to use the client's default printer rather than the server?
The answers to your questions:
MS VS 2008 Professional Edition V3.5 SP1
ASP.NET 2.0.50727
C#
Crystal Reports Enterprise 10
My code:
protected void LoadLabels(int Start)
{
StoreNumber = RemoteAddress.Split('.')[2];
ReportDocument reportDocument = new ReportDocument();
reportDocument.Load("C:
Inetpub
wwwroot
ShoeReport
admin
DisplayLabel.rpt");
ConnectionInfo ci = new ConnectionInfo();
ci.ServerName = "DEV1";
ci.DatabaseName = "ShoeReport";
ci.UserID = "sa";
ci.Password = "xxxxx";
TableLogOnInfo li;
foreach (CrystalDecisions.CrystalReports.Engine.Table tbl in reportDocument.Database.Tables)
{
li = tbl.LogOnInfo;
li.ConnectionInfo = ci;
tbl.ApplyLogOnInfo(li);
}
reportDocument.SetParameterValue("@Store", StoreNumber);
reportDocument.SetParameterValue("@StartAt", Start);
//reportDocument.PrintToPrinter(1, true, 0, 0);
string PDFPath;
PDFPath = "C:" + "
" + StoreNumber.ToString() + "_DisplayStickers.pdf";
reportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, PDFPath);
reportDocument.Dispose();
reportDocument = null;
ci = null;
li = null;
System.Diagnostics.Process.Start(PDFPath);
}
Yeah if there is some way to force the code to use the client side default printer I would have all my problems solved. They don't need to select nor will they ever need to select the printer.
My export to PDF and then opening it back up works but it throws off all the labels so they don't line up on the sheet so I can't use that.
There's got to be a way to force it to use the client default printer right?
There's got to be a way to force it to use the client default printer right?
- Yes there is, but before we go there we have some inconsistencies to work through;
MS VS 2008 Professional Edition V3.5 SP1
ASP.NET 2.0.50727
C#
Crystal Reports Enterprise 10
1) Your code is not using Enterprise SDK, it's a "plain jane" CR SDK
2) CR 10 \ Enterprise 10 does not work in VS2008
So, check the CR references and tell me the version of the assembly CrystalDecisions. CrystalReports.Engine.dll. Also, let me know all the other CR referenced made in your project.
- Ludek
No problem!
I actually develope3d the report in Crystal Reports 11 Professional Version 11.0.0.895 but the company I work for wantes me to use Crystal Enterprise 10 so that's why I stated that for use. Will CR 11 work?
The references in my Project are:
CrystalDecisions.CrystalReports.Engine Version 10.5.3700.0
CrystalDecisions.ReportSource Version 10.5.3700.0
CrystalDecisions.Shared Version 10.5.3700.0
CrystalDecisions.Web Version 10.5.3700.0
Please let me know if I am missing something. I really appreciate all your help!
Hmmm - well, you are using the version of Crystal Reports that bundles with .NET 2008 (also known as Crystal Reports Basic for Visual Studio 2008, not to be confused with CR 2008 which has version 12.x). In any case. As you can see from the name of the product, you are using Crystal Reports, not CR Enterprise or BO Enterprise...
You'll have to figure out what the company actually wants to use. Enterprise is way more involved, way more functional, way more expensive. E.g.; as Crystal Reports Basic for Visual Studio 2008 bundled with .NET it was essentially free.
The Enterprie SDK is much different and updating the app is not a simple upgrade. Rather it would be a total rewrite...
Another point. Creating reports in one version of CR and using a lower version runtime is never a good idea. While this will work - to a point - you are risking that the lower version runtime may not udnerstand some features introduced in the higher version of CR...
Once you have addressed the above concerns, have a look at the article [Printing Web based reports with Crystal Reports for Visual Studio .NET|http://www.sdn.sap.com/irj/boc/index?rid=/library/uuid/600c24a3-ab1d-2b10-1bb4-c50562e353cb].
Also see the sample app csharp_win_printtoprinter.zip at the following link:
https://wiki.sdn.sap.com/wiki/display/BOBJ/CrystalReportsfor.NETSDK+Samples
(I don't have a web app, but the code is the same)
This code will still only print locally. To print to the client's computer, you have to configure things as per the KB article I provided earlier on;
http://support.microsoft.com/kb/184291/en-us
Also, make sure you have applied Service Pack 1:
https://smpdl.sap-ag.de/~sapidp/012002523100009351512008E/crbasic2008sp1.exe
SP1 runtime:
CRRedist2008_ia64.msi
https://smpdl.sap-ag.de/~sapidp/012002523100006255262008E/CRRedist2008_ia64.zip
CRRedist2008_x64.msi
https://smpdl.sap-ag.de/~sapidp/012002523100006255272008E/CRRedist2008_x64.zip
CRRedist2008_x86.msi
https://smpdl.sap-ag.de/~sapidp/012002523100009351342008E/CRBasicVS2008_redist_x86.zip
Another FYI. InProc RAS SDK is not part of CR 10.5, so we will not be using that.
- Ludek
Okay I believe I did everything you listed.
I went on the DEV server and made the registry changes per the KB article.
I did the upgrade to SP1 (however when I launched CR Professional 11 I didn't see anywhere in the Help/About Crystal Reports that shows the upgrade).
I downloaded the sample project and looked at the code and it appears to be doing exactly what I am doing as far as sending the report to the printer using
reportDocument.PrintToPrinter(1, true, 0, 0);
I am ready for the next step if there is one....when I tried to run my web app and print on the DEV server it just hung and no printing occured....I feel like I am missing something simple....
SP 1 was not for CR 11, it was for CR 10.5. Remember I said that your references in your .NET project are to Crystal Reports Basic for Visual Studio 2008? Thus the name of the SP1 download: crbasic2008sp1.exe ;
Now the next step; have a look at the blog [Server side printing with Crystal .NET SDK|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/23359] [original link is broken] [original link is broken] [original link is broken];.
But in a nut shell, here are the steps (let's consider two client computers):
1) Install the printer driver on client A and client B
2) Install the printer driver as per the Microsoft KBase I linked to. At the end of this, you will have something like clientA_HP100, clientB_HP100
3) As per the Microsoft KBase ensure the correct permissions are given to the worker process - this is not part of the CR SDK
4) In your app, determine who requested the print job - client A or client B -again, this is not part of the CR SDK
5) In your app, select and set the appropriate printer driver name; clientA_HP100 or clientB_HP100
Not trivial - I understand, but that is how client side printing works if you do not want user intervention. Sometimes the designers of these apps forgo direct printing and stream the document to the user as a PDF, MS Word, what ever and let the user print using those document's print dialog.
- Ludek
You know, I was just playing around with the exporting of CR to MSWord and opening it back up for the user right after the export so they can print local and it seems to have saved the formatting for the label sheet unlike Adobe PDF which warped the margins etc. I think I may go that route as it seems to be the least amount of hassle. If the end user/client hopefully accepts this method of having one extra step of having to click print on a Word document then I think I am good to go. I am crossing my fingers for that.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.