SAP Knowledge Base Article - Public

1958435 - Enhancement: How to retrieve and use Custom Papers sizes by custom paper size Name


  • Designing the report:
    • When creating a custom paper size for a printer you can give it a name. The OS then assigns a random ENUM value for that paper size, typically above 256.
    • This ENUM is saved in the Crystal Reports RPT file.
  • Tthe issue:
    • User installs the printer driver on his/her local PC and creates the same custom paper size. The ENUM is likely different...
    • Sending the report to another user and/or opening the report in a custom application the ENUM value for that paper size likely will not be the same as the original peper size ENUM.
  • What happens:
    • CR Designer and .NET application will look for the printer and customer paper size and it can't be found, because the ENUM is the wrong value.
    • CR then indicates the design printer cannot be found and defaults to the users default printer removing formatting, orientation ( possibly ) and defaulting typically to letter size paper.



  • Crystal Reports Developer for Visual Studio, Service Pack 8
  • Crystal Reports Designer 2011
  • Crystal Reports Designer 2013


  1. When Designing reports use a printer that best fits your output destination and format.
  2. Save the printer with the report.
  3. As you can see below You can get the Customer Paper Size ENUM as well as the Customer paper size name along with the printer name saved in the report.


     4.  With this info you can now use CopyTo/CopyFrom in both RAS and the ClientDocument to set the printer and custom paper size as defined in the report.

     5.  Only requirements are the Printer is installed on the work station and the custom paper size name is exactly the same as what is saved in the report.

Code sample:

rptClientDoc = rpt.ReportClientDocument;
CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions rptPRT = new CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions();
CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions rptPRTCloned = new CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions();
PrinterSettings ps = new PrinterSettings();
PageSettings pgs = new PageSettings();
rptPRT = rptClientDoc.PrintOutputController.GetPrintOptions();
rptPRTCloned = rptPRT.Clone();
PrintLayout.Scaling = PrintLayoutSettings.PrintScaling.DoNotScale;
if (rpt.PrintOptions.SavedPrinterName.Length != 0)
    btnSavedPrinterName.Text = rpt.PrintOptions.SavedPrinterName.ToString();
    btnSavedPrinterName.Text = rptPRT.SavedPrinterName.ToString();
//SP 8
if (rptPRT.DriverName != "DISPLAY")
    btnPaperSizeName.Text = rptPRT.PaperName.ToString();
    if (rptPRT.PaperName.ToString() == "")
        btnPaperSizeName.Text = "Printer not installed";
    btnPaperSizeName.Text = "Printer is Display";
catch (Exception ex)
    btnSQLStatement.Text = "ERROR: " + ex.Message;
//rpt.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
//rpt.PrintOptions.CopyTo(ps, pgs);
CRPaperSize.Text = rptPRT.PaperSize.ToString();
CRPrinterName.Text = ps.PrinterName;
// New API in SP4
CRPrinterName.Text = rptPRT.SavedPrinterName.ToString();
  • Also note: this update has been done for printcontrol.dll and can be used in BI 4.x.
  • Update the reports so the printer info is saved and then re-bublish them or update them in the Repository.
  • When printing the user should see the defaults as defined client side.

See Also

Open the attached sample application to use CopyTo/CopyFrom the printer info from the report and copy to the SystemPrinter selected.


CRVS CR NET printer special RAS Crystal 2010 2012 , KBA , BI-DEV-NET-SDK , .NET SDK / COM SDK , Product Enhancement


SAP Crystal Reports, developer version for Microsoft Visual Studio