on 10-01-2014 2:35 PM
I have just installed SP11 for Visual Studio but when I go to print this causes the program to crash with the message that VSHOST32 has stopped working.
Not sure how to fix that
Installed on Windows 8.1 64 using the SP11 EXE installer
Regards
David
Hi, same Problem here.
CR crashes when ReportDocument.PrintOptions.PrinterName is set.
SP10 works . SP11 crashes here with c:\Windows\SysWOW64\ntdll.dll error visible in applicationlog in eventvwr.
I use .Net Frame Work 3.5 in a 32Bit app.
Jürgen Bauer
Even pressing printbutton from Viewer crashes application.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guys,
Sorry about that. R&D And I added a new property for BI 4.x so when you publish a report to Enterprise the Work station will find the saved printer name and custom paper size.
We did not think many people used the original property so they changed it from PrintOptions.PrinterName
to:
PrintOptions.SavedPrinterName
What you will see in CR Designer is something like this, once CR Designer SP has been released:
So now when you set the Viewer in BI 4.x on the workstation to ActiveX it should simply find the printer and custom paper size, or the correct paper size, and the user can just hit the print button without having to manually select the printer and paper size.
It will require each report to be resaved though but should take a lot of the guess work out of printing.
The fix is simple, change your reference and recompile.
Actually you would not have been able to recompile with SP 11 without changing the name in your code.
Don
Hi Don
Changing the signature from "PrinterName" to "SavedPrinterName" was a joke.
This makes the patch absolutly incompatible. You can compare this with a new release.
A patch corrects failures, and perhabps adds new fatures, but is in its signature compatible.
We have here severel applications, running on more than 300 pc's on 4 sites in 3 countries. Each pc could have different patchlevels.
We can't switch adhoc from one patchlevel to an other. Also some pc do label printing on Zebra printers. Here we sometimes have problems with correct printout after changing the patchlevel.
Changing the reports is also not a solution. We use here about 1200 different reports.
Jürgen Bauer
Hi Don
Surely if there was a need for PrintOptions.SavedPrinterName it would have been better to add this as a new and extra option / extension, and to have left PrintOptions.PrinterName as it was? That would have saved the problem of needing to recompile after the SP11 was installed plus it would have saved me a heart attack when my program crashed after installing SP11
I would imagine that there are going to be a lot more users affected by that change other than just Jurgens and me.
Regards
David
Hi Don
I see that there is a SP12 - does this restore the original method and use of PrintOptions.PrinterName property to the way it was in SP10 and earlier?
Regards
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Don, but I suspect that there will be a few people who will be affected by that change. I use it so that different reports can be set to print on the correct printer. For example some reports are printed on A4 size paper on a Laser Printer while some reports are printed as labels on a label printer from the same program. I would think that you should add a note on the download page advising the change required in the code
Regards
David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
Good idea... I will do that. I meant to get this kbased also but ran out of time. Putting it in the same area is a great idea...
Also, on the Crystal Design forum under documents Ludek and I have been putting together an "answer all" set of WIKI's on printing which you should have a look over.
We'll be adding more on using the SDK once we get time also.
Here are the links:
http://scn.sap.com/docs/DOC-58131
http://scn.sap.com/docs/DOC-57979
http://scn.sap.com/docs/DOC-58131
Thanks again
Don
PS - download page is updated
Hi Don
Thank you for the information on the links
I would agree with Jurgen that changing from "PrinterName" to "SavedPrinterName" is not something that I would expect in a Patch or Service Pack. I do not see any purpose, justification or need to change from PrinterName to SavedPrinterName as I do not see any benefit or that it makes the code any better or clearer. PrinterName is clear and does what it says, why change? In some respects to me SavedPrinterName is less obvious as to what it is intended to be and do.
Certainly the change of extension created a problem and wasted a great deal of time between downloading the SP11, installing, finding a problem, finding a solution, uninstalling, downloading SP10 and installing that.
Regards
David
Hi don,
Changing a name is a breaking change.
Causing a lot of wasted time. If an application needs to be rolled back, CR needs to be downgraded too.
As others say, the name PrinterName is just fine and does what it says.
Adding 'SavedPrinterName' as a second property is also an option (if naming matters).
People who prefer 'SavedPrinterName' can use it, others can still use 'PrinterName' without any code change (if possible at all), and under water the last property can call the first one (or the other way around)
Makes it all compatible, less effort to update, deploy and support new version.
Regards,
Hello Don
Before I go through the time wasting exercise of having reinstall SP11, is the change of PrintOptions.PrinterName being renamed to PrintOptions.SavedPrinterName the only reason that SP11 caused printing to crash with the message that VSHOST32 has stopped working? Are there any other changes that I need to be aware of?
But I still do not understand the logic that PrintOptions.SavedPrinterName was not added as an extra option rather than changing and removing PrintOptions.PrinterName
That you made the change of a property name without any pre-warning of the change does not instil a great deal of confidence in happily installing future updates.
Surely if there was a need for a new property name then it should have been added as an extra option so that there was backward compatibility and developers could have been warned to change to the new property without creating the problems of an unannounced change?
For what it is worth I think that PrintOptions.PrinterName is a clearer and better property name as to what it is for than is PrintOptions.SavedPrinterName. I do not understand why there was a need to change the property name or what benefit it provides.
Certainly the change created a great deal of wasted time and effort. But I did learn a lesson, do not install updates if you do not have time to solve any problems that arise as a result.
Regards
David
That is the only change.
It follows the update to the newer property SavedPaperName, R&D wanted them to be the same and going forward it makes more sense.
The PritnerName could mean a lot of things, SavedPrinterName is as it indicates, it is saved in the RPT file.
And yes my fault for not making it public when I heard they changed it. When I tested a beta of SP 11 I got the same error.
I asked them why they changed it also and it just makes more sense in the overall picture of the new CR Designer functionality also.
Don
Hi Don
I am now confused.
I re-installed SP11 and changed PrintOptions.PrinterName to PrintOptions.SavedPrinterName but that causes a compile error = Error 1 Property 'SavedPrinterName' is 'ReadOnly'.
PrintOptions.PrinterName is still shown as a property for PrintOptions. PrintOptions.SavedPrinterName is also shown as a property for PrintOptions, why is that? PrintOptions.PrinterName is shown as a String
PrintOptions.PrinterName I have had coded to be the Printer Name for example ReportDocument.PrintOptions.PrinterName ="HP LaserJet" - That does not work with ReportDocument.PrintOptions.SavedPrinterName = "HP LaserJet"
So it looks as though I have to once again uninstall SP11 and reinstall SP10
With SP11 if you need to select a printer at runtime from a Printer set as the default printer required for that report, how do you now do that when PrintOptions.SavedPrinterName is read only? If SavedPrinterName is read only where do you now set the name of the printer that should be used?
I also note that there is no SavedPaperName property in the list of properties shown for PrintOptions - and that I do not understand based on what you have said
Regards
David
Hi David,
Ah, yes of course.... SavedPrinterName is read only and that is by design because you are getting the info from the RPT file itself.
I had to change my code because of the way I was using the PrinterName, so it's all in the way you were using the Property... Sorry I didn't think of other scenarios that developers would be using that property. so for you all you need to do is leave your code as is and just recompile.
The reason it crashed the app is because likely the pointer for the API's changed, so simply recompiling should resolve that error.
With the new property now you can get the printer the report was designed with. So if the Design printer is not found you now have the ability to know what it was and can handle the messaging.
Those WIKI's are the beginning of how this will all work:
http://scn.sap.com/docs/DOC-58131
http://scn.sap.com/docs/DOC-57979
http://scn.sap.com/docs/DOC-58131
This will now allow you to handle the printer the same as we do in CR Designer, if you get a report that you don't have the printer installed you get the message:
Now you can manage that part also if you have reports that are designed specifically for a specific printers. This is the goal for these new properties and work flows.
When CR and BI 4.x are updated and released, now when printing a report with a custom paper size from a work station using the ActiveX Viewer it will look for the Printer, then the ENUM the custom paper size has assigned to it and the if that enum is not found or different than what the Custom Paper size Name when the report was designed the PrintControl dll will find the paper by name and not by ENUM. The same printer driver must be installed on each work station and the custom paper size must be exactly the same on the Server and Work station. Then the user should simply be able to hit the Print button, the PrintControl dll should find and set the correct printer and paper and the user does not have to go browsing for it each time they print.
One other ER to note, In CR Designer a custom paper size was defined as User Defined. With the introduction of Dissociate you now have the ability to determine if the paper size is User Defined paper size. Previously they were defined as crPaperSizeDefault. This is why if you wanted to use a paper size of say 42 inches wide you had to install a printer that was capable of printing that size ( HP Plotters was the norm ). With Dissociate checked on you can now define a paper size without having a printer capable of printing that size. Through code the printer property will now return crPaperSizeUser when you do the above, Dissociate and User Defined paper size.
I'll set a time next week to properly kbase/wiki this and update this thread also. I'll also update the Warning on the download page... ( Done )
Don
Hi Don
Thank you for the reply, but recompiling after installing SP11 did not work in my case. When I first installed SP11 and found my program crashed when I tried to print, my first thought was to recompile which I did, but that did not solve the problem. After recompiling the program would still crash even in debug mode when I tried to print. The only cure was to revert again to SP10
Yesterday I tried reinstalling SP11 and then found that the SavedPrinterName was a read only property and that PrinterName was still shown as a property. I tried recompiling without the SavedPrinterName property, but SP11 still causes the program to crash when trying to print.
But I am confused as in your original reply to my post you said
We did not think many people used the original property so they changed it from PrintOptions.PrinterName to: PrintOptions.SavedPrinterName
But now you are saying in your last reply that PrintOptions.PrinterName is still a valid property and code.
Certainly in my case recompiling after installing SP11 is not a solution. The only solution I have is to revert to SP10
If the pointer for the API's changed, recompiling is not solving that problem
Solution still required for SP11
Out of interest using SP10 the property PrintOptions.SavedPrinterName is visible and if used does show the name of the printer used to make the report, but when used causes an error with any code that follows it related to the report settings. Presumably the property has been left installed although SP11 has been uninstalled, and hence the problem using it.
Regards
David
Hi Don
Thank you for the reply
Are you using the PrintOptions.PrinterName property at runtime in the code to create and print the report?
Having said at the start of this discussion that you had renamed PrintOptions.PrinterName, I am now not sure if this is still a valid property or if it should work? Certainly it does not cause any error when you compile. It only causes a problem at runtime
Regards
David
Hi Don
The parts of the code to do with setting up and printing the report that I use are
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Windows
Imports CrystalDecisions.ReportAppServer
myReportDocument = New ReportDocument()
myReportDocument.Load(reportPath)
myReportDocument.SetDataSource(ds)
myReportDocument.PrintOptions.PrinterName = drUserInfo.Item("DefaultPrinter").ToString
myReportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = False
myReportDocument.PrintOptions.PaperSize = PaperSize.PaperA4
myReportDocument.PrintOptions.PaperOrientation = PaperOrientation.Portrait
Dim margins As PageMargins
margins = myReportDocument.PrintOptions.PageMargins
margins.bottomMargin = 0
margins.leftMargin = 0 '350
margins.rightMargin = 0
margins.topMargin = 0
myReportDocument.PrintOptions.ApplyPageMargins(margins)
Dim txtObj As TextObject
txtObj = CType(myReportDocument.ReportDefinition.ReportObjects("Text1"), TextObject)
txtObj.Text = "From:" & vbCrLf & drUserInfo.Item("FirstName").ToString.Trim & " " & drUserInfo.Item("Surname").ToString.Trim & vbCrLf & drUserInfo.Item("Address").ToString.Trim & vbCrLf & drUserInfo.Item("Country").ToString.Trim & vbCrLf & vbCrLf & drUserInfo.Item("Email").ToString.Trim & vbCrLf & drUserInfo.Item("URL").ToString.Trim
'auto print
myReportDocument.PrintToPrinter(1, False, 0, 0)
myReportDocument.Close()
myReportDocument.Dispose()
myReportDocument = Nothing
Do you want more than this?
The code works in SP10 without any problem. The problem only occurs when SP11 is installed
Regards
David
Hi Don, Hi David,
in my Software I print the same way.
I just use VS2013, on Win7 64Bit and build a 32Bit Application. The crystalreports are designed with standalone CR10 Designer using SQL-Server storedprocesdures and/or ttx-files. Datasource is set on runtime from a DataTable.
Just recompile also didn't work for me. When i use the property PrinterName the Programm crashes..
Jürgen
If PrintOptions.SavedPrinterName is readonly, then it makes sense that it returns just the saved printername in the report.
However, when printing reports in background (service), without a user interface available, PrintOptions.PrinterName should be there to set the destination printer where to print.
If PrintOptions.SavedPrinterName is just a new property, then recompiling should not be necessary, unless constants or enum values are changed.
Hi Don
drUserInfo is the record from the database that holds default values for the printer to be used for the report
Defined as Private drUserInfo As DataRow - I am quite sure that is not causing the problem as it simply providing the name of the printer. This could be equally replaced with "PrinterName" rather than being from a database record
Jurgen has much the same other than he uses MS SQL and I use MySql
But what I do not understand is why you originally said that PrinterName had been renamed SavedPrinterName, but later in this discussion you indicate that PrinterName should still work
As Jurgen says, remove PrinterName as a property and SP11 will print, but then you cannot direct the print output to a particular printer.
Also SavedPrinterName is now shown as a property in SP10 when it is a new property for SP11. In SP10 if you use it, it does cause problems.
Regards
David
Hi David,
I don't need the declaration for the printer, I just hard coded it. It's odd that duplex works, nothing else does though...
So WOW, I have to apologize, I never expected something as simple as this API to cause a problem or have a bug introduced into it...
I can replicate the issue now.
PrintOutputControl does not have this problem. So if you need a quick fix you'll have to use it or go back to SP 10 for now.
I've notified R&D and we'll see what they have to say about it tomorrow... And what we can do for everyone...
Thanks again
Don
Here's how to use POC to print:
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.ReportAppServer;
using CrystalDecisions.ReportAppServer.ClientDoc;
using CrystalDecisions.ReportAppServer.Controllers;
using CrystalDecisions.ReportAppServer.ReportDefModel;
using CrystalDecisions.ReportAppServer.CommonControls;
using CrystalDecisions.ReportAppServer.CommLayer;
using CrystalDecisions.ReportAppServer.CommonObjectModel;
using CrystalDecisions.ReportAppServer.ObjectFactory;
using CrystalDecisions.ReportAppServer.Prompting;
using System.Data.OleDb;
using CrystalDecisions.ReportAppServer.DataSetConversion;
using CrystalDecisions.ReportAppServer.DataDefModel;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Windows.Forms;
using System.Runtime.InteropServices;
When you open the report assign it the ReportClientDocument for RAS to modify the report:
rptClientDoc = new CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument();
rptClientDoc = rpt.ReportClientDocument;
private void btnPOController_Click_1(object sender, System.EventArgs e) // Print To P button
{
System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();
CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions rasPROpts = new CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions();
CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions RASPO = new CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions();
RASPO.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;
rasPROpts.PrinterName = cboCurrentPrinters.Text;
int[] sizes = PaperSizeGetter.Get_PaperSizes(cboCurrentPrinters.Text, "");
int paperSizeid = sizes[this.cboCurrentPaperSizes.SelectedIndex];
if (paperSizeid > 0)
{
rasPROpts.PaperSize = (CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSizeEnum)paperSizeid;
}
rasPROpts.BinName = cboCurrentPaperTrays.SelectedItem.ToString();
rasPROpts.NumberOfCopies = 1;
//rasPROpts.AddPrinterPageRange(1, 1);
//rasPROpts.AddPrinterPageRange(5, 7);
//rasPROpts.GetNthPrinterPageRange(1, st, ot);
rasPROpts.PrinterDuplex = CrPrinterDuplexEnum.crPrinterDuplexSimplex;
rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationPortrait);
string MyRptName = rpt.FileName.ToString();
MyRptName = MyRptName.Substring(MyRptName.LastIndexOf(@"\") + 1, (rpt.FileName.Length - 3) - (MyRptName.LastIndexOf(@"\") + 2));
rasPROpts.JobTitle = MyRptName;
RASPO.DissociatePageSizeAndPrinterPaperSize = true;
rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationPortrait);
try
{
rptClientDoc.PrintOutputController.PrintReport(rasPROpts);
}
catch (Exception ex)
{
MessageBox.Show("ERROR: " + ex.Message);
return;
}
//MessageBox.Show("Printing report.", "RAS", MessageBoxButtons.OK, MessageBoxIcon.Information);
IsRpt = false;
}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.