1904650 - How to: set PrinterDuplex using ClientDocument in .NET Windows app

SAP Knowledge Base Article - Public

1904650 - How to: set PrinterDuplex using ClientDocument in .NET Windows app


System Printer options support Duplex printing, how to set Duplex options in code


Crystal Reports Developer for Visual Studio



See attached sample app on how to.

Details to do so is to get the duplex options in from the Printer list:

private void SetPrintOptions()
    PrintOptions printOptions = rpt.PrintOptions;
    System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();

    printOptions.PaperOrientation = (PaperOrientation)paperOrientationList.SelectedIndex;

    int rawKind;
    rawKind = GetSelectedPaperSize().RawKind;
    printOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;

    // Don - added these lines add what ever specific printer properties you need to set
    printOptions.CustomPaperSource = GetSelectedPaperSource();
    printOptions.PrinterDuplex = PrinterDuplex.Default;

    printOptions.PrinterDuplex = (PrinterDuplex)printerDuplexList.SelectedIndex;
    printOptions.DissociatePageSizeAndPrinterPaperSize = true;

Now when printing use the CopyTo to update the report:

private void printReport_Click(object sender, EventArgs e)

        rpt.PrintOptions.PrinterName = printerList.Text;

        System.Drawing.Printing.PageSettings pageSettings = new System.Drawing.Printing.PageSettings();
        System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();
        CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();

        PrintLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale;
        pageSettings.PaperSource = GetSelectedPaperSource();

        // Call ReportDocument.PrintOptions.CopyTo method
        rpt.PrintOptions.CopyTo(printerSettings, pageSettings);

//          rpt.PrintToPrinter(1, false, 1, 99);

        message.Text = MessageConstants.SUCCESS;
    catch (Exception ex)
        message.Text = MessageConstants.FAILURE + ex.Message;


NOTE: RAS ( Report Application Server ) will have a CopyTo/CopyFrom set of API's that does the same as PrintToPrinter in Service Pack 7


KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem


SAP Crystal Reports, developer version for Microsoft Visual Studio