Skip to Content

Printing out of Viewer suggests wrong printer

I'm using CRVS with SP18.

The Viewer works with PrintMode set to "PrintMode.PrintOutputController". Now when the report is drawn in the viewer, the customer clicks on the Print-Button in the toolbar which internally executes CrystalDecisions.Windows.Forms.CrystalReportViewer.PrintReport().

When the print dialog opens, the default printer is suggested. How can I propose another printer to the customer?

I tried several ways setting the printer for the viewer print dialog:

  • CrystalDecisions.CrystalReports.Engine.PrintOptions.PrinterName
  • CrystalDecisions.CrystalReports.Engine.ReportDocument.ReportClientDocument.PrintOutputController.GetPrintOptions.PrinterName
  • CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions.PrinterName
  • System.Drawing.Printing.PrintDocument.PrinterSettings.PrinterName

None of them works....



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Apr 26, 2018 at 03:20 PM

    Hi Patrick,

    See your other post for more info.

    Yes R&D asked me the same thing, why my logic was so complex... I was building the steps as I was trying to figure out what the engine was doing. I just never went back to clean it up. I'm sure there is a much simpler way to get the info, I just have not had time to go back and fix it.

    With the abilities of RAS added to CR runtime it is now left up to the end developer to add the steps/logic to handle most report coding. The old RDC engine had a lot of it embedded in it but with the update to .NET it's mostly left up to the Developer to do the back end coding now.

    It's the nature of .NET, if we hard code it then it limits what the end developer can do, as long as we expose the property bags you can handle it yourself.

    I have been meaning to get back to it and will try to fix it up...

    Thanks again


    Update: SO I had a closer look at the code I used and I don't want to alter it from what it is doing. It needs to determine if the Page Setup was used in the Report, because if it was not then those values are used, if it was clicked but... then those values are using and if No Printer is used then this logic flow....

    I could changed it just for display purposes but other routines in the app use those values and reads from the screen so it's good the way it is.

    Thanks again


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 19, 2018 at 04:10 PM

    Hi Patrick

    Ah, that changes things...

    Depends on your reports. So for basic letter paper size reports then using P2P will always select the users Default printer, that is basic work flow for P2P, cannot change it. And if you use Dissociate the engine will try to find a matching paper size and margins for the Users default printer.

    For custom paper sizes it's always better to use a specific printer or using POC to set the printer at run time.

    Years ago most Rep's suggested using no printer option. Updates in CR 2008+ now we recommend not using No Printer, I've never suggested that except in special cases.

    Basic differences are P2P uses the Windows Printer Common dialog box, POC uses the same Dialog box CR Designer uses and gives you more control over the printers.

    So it's more of what ever fits your application is the better one to use.

    I do suggest not using No Printer because the report formatting engine then uses USP10.dll and GDIPlus and some of the users default printer properties. Even with basic paper sizes it can cause margin issues, some printers have less printable area so it can cause formatting changes.

    Best thing to do is always use a real printer when designing reports, check on Dissociate and save the report. This way if the Printer cannot be found CR will look for the same "family" of printers the report was designed against and format accordingly.

    If you need specific paper sizes, for preprinted forms and those types then always use a specific printer family and class of printers. And name all of the custom paper sizes with the exact same name, the Engine/RAS will look for the paper size name first and then by ENUM.

    So to answer your question it's all up to you which one works best but depends on the work flow and how the reports are designed and if they need to use specific printers and printer properties.

    Just remember when No Printer is selected it uses USP10.dll, GDIplus and the users default printer to format.

    Some Developers actually saves the printer properties into a database field with the ability to update the defaults in their app interface and then use CopyTo/CopyFrom to save/update the report printer properties. That way it's consistent and then do't have to use multiple routines to manage them.

    Lot's of options, lot's of features, all depends on how much you want make it User Proof...

    May also cause you to list specific printers you support... but again all depends on your application and reports.


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 13, 2018 at 03:16 PM

    Hi Patrick,

    In my test app see what it returns.

    Likely cause is you have No Printer checked on and maybe Dissociate not checked on.

    In that case you have not told the engine what printer to select so it will always default to the default printer.

    In more current versions of CR Designer when you Print the report you'll see the Saved Printer name and Saved Paper size in the dialog box.

    If you don't see this in your reports the default is is to use the Default printer, we can't select a printer if you don't tell us which one to use....


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 16, 2018 at 07:28 AM

    The report has no saved printer name.

    My initial question should be: depending on the PrintMode of the Viewer (POC or P2P) is it important to choose the right fitting method (also RAS - Engine, POC...) to set the printer for the Viewer?


    Add comment
    10|10000 characters needed characters exceeded

  • Apr 24, 2018 at 12:38 PM

    Wow, that's what I call a real answer / résumé - thanks Don.

    Now the "but" ;-)

    Sometimes I'm asking me why CR does is make so hard to use its interface (instead of saying "a lot of options" I would sometimes say "too much options or possibilities"). As end-programmer I have to get it work for the all customers, independent of OS, of printer brands and of paper sizes!

    We use generic reports normally set with "No Printer" and "Dissociate" checked on. Nearly 95% of them use A4 as paper size, only some exceptions exist for Dymo-reports which has to be adapted on customer's side due to ENUM differences... But as our ERP uses generic standard reports we don't want to adapt them all on customer's side. We also save printer properties in database, but sometimes re-setting them on customer's side by CR VS doesn't achieve the aim.

    ER: have a transparent printer management/interface through CR, independent of using P2P or POC, RAS or whatever. The CR-guys from R&D are the professionals for printing issues...

    If I ever would implement the complex logic from getPrinterInfoOnOpen() out of your sample app, and if R&D would change their logic inside CR VS, how would I or you get notified of that change? It would much easier if all that logic remain inside CR VS....

    Just some thoughts.



    Add comment
    10|10000 characters needed characters exceeded

  • Apr 24, 2018 at 04:08 PM

    Hi Patrick,

    There is currently a lot of logic built into the engine to determine printer settings. We can't do it all because most developers have a different work flow.

    P2P will never change because it's the basic from early days of Visual Studio, when we we integrated into VS Installer. No RAS with that version either.

    The biggest thing you need to do is open each report up in a current version of CR Designer and save it with those printer properties.

    Also with the updated CR Designers you can now get the history of the report:


    You can get these values using the engine now also, and use it to test if the report is up to date or not. Using SaveAs() will update the history, only that and in CR Designers (craxddrt) are capable of updating the history, did this on purpose so only a few work flows will actually update that collection. And it's read only.

    Back to the printers...

    Here's some pic's of using custom paper sizes.

    Note the Printer name and Paper name saved in the report matches the paper name in the printer... ( Argox printer and Label paper name )


    So now when you setup the printer the engine is looking for that printer name:

    So this takes care of the paper size ENUM, most printers randomly assign the ENUM, Seagull Scientific printer drivers allow you to specify the ENUM so it can be set up the same way one every printer on site+. But they are not free but I found them to be the most consistent and configurable. And they have been doing it for a long time so have a great rack record for their drivers and supportability.

    So because CR is SO dependent on the OS, Hardware, hardware drivers, printers and printer drivers it's not that easy to manage, so many variables. What I've done working with R&D is find ways to at least get the Printer properties and have the ability of the Developers using our SDK's to be able to manage them relatively easy. One ER I had them add was to look for the Printer name and not just the ENUM, because that really caused problems, as you know.

    Final note is it's all up to you to manage the printers, because there are so many variables and so many printers and then drop in Microsoft's Framework it's all we can do to keep them working....

    For even more info about printing check this set of Doc's out:

    Bottom line is keep your reports up to date or as close to current versions as possible and have a remember CR is Hardware reliant when it comes to formatting and how your reports rely on printer hardware and drivers and be specific specifying supported printers as much as you can ( that's funny ) for which printers you support... About as much as we can do also...

    It's all dependent on your application, governments. Legals, etc. require exact placement and paper type etc. to be used so in those cases you need to design and support those specific classes of printers....

    It is a huge task to support everything but we are trying to make is as easy for the developer as we can and support across all platforms and uses...

    Have fun


    Add comment
    10|10000 characters needed characters exceeded