1563479 - Page Scaling issue when printing from the .NET Winform Application

SAP Knowledge Base Article - Public

1563479 - Page Scaling issue when printing from the .NET Winform Application

Symptom

  • Page Scaling issue when printing from the .NET Winform Application
  • Printout from the .NET Winform Application is different of the one from Crystal Report Designer Application

Environment

Environment:

  • CR 2008 + SP3
  • Visual Studio 2008
  • SAP Crystal Reports, Developer Version for Visual Studio .NET

Reproducing the Issue

How to reproduce the issue:

A) Print Through .NET Winform Application

1) Download the attachment that contains a sample .NET Winform Application

2) Then run the Application which will load the report into the viewer

3) Before printing, check the Print Layout Options which is grayed out and set to: “Scale Report Page to Fit Printer Page” and the Paper Size is set to A4 and the Page Orientation to Portrait.

4) Now click on the costumed Print button on the Win Form to print the report through the method PrinterToPrint of the ReportDocument Or print through the CrystalReportViewer.

5) Both methods give the same PrintOut. The PrintOut shows larger margins compared from the PrintOut from the .NET Application.

 B) Print through Crystal Report Designer

1) Download the same attachment and it contains the report

2) Open the report through Crystal Report Designer

3) Before printing, check the Print Layout Options which is grayed out and set to: “Do Not Scale Report Page” (which is different from the Print Layout Options when the .NET environment), and check the Paper Size is set to A4 and and the Page Orientation to Portrait.

4) Now Click Print to print the report

5) This will give a PrintOut different from the one obtained through the .Net environment.

The PrintOut Shows almost No Margins.

The attachment contains the scanned PrintOuts for both scenarios (.NET and Designer):

“PrintOutFromDESIGNER2008.pdf” and “PrintoutFromDotnet.pdf”

The attachment contains a doc file named “Explanation.doc” that explains the issue using screenshots.

Resolution

CAUTION
The following resolution involves editing the registry. Using the Registry Editor incorrectly can cause serious problems that may require you to reinstall the Microsoft Windows operating system. Use the Registry Editor at your own risk. It is strongly recommended that you make a backup copy of the registry files before you edit the registry. Fo
  • The issue has been resolved with the info below.

CR designer version CR 2008 SP4 or later will be turn on minimal margins function with register key:

  • [HKEY_LOCAL_MACHINE\SOFTWARE\Business Objects\Suite 12.0\Crystal Reports\DesignerOptions] "DealWithMinimalMarginsWhenPrinting"="1"
  1. When dissociate formatting page size and printer paper size is checked:
    "Reg key =1" or "no" key, keep large marings.
    "Reg key = 0", turn on minimal margins printing.
  2. When dissociate formatting page size and printer paper size is unchecked:
    The reg key does not take effect. Always print minimal margins.

************************************************************************************************

Workaround:

1. Replace the printing method with CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument.PrintOutputController.PrintReport which is from RAS.NET. This method will be "always" controlled by reg key "DealWithMinimalMarginsWhenPrinting":
"Reg key =1" or "no" key, keep large marings.
"Reg key = 0", turn on minimal margins printing.

Limitation and tips of RAS.NET printing method:
<1> PrintOptions.DissociatePageSizeAndPrinterPaperSize will not take effect bucause "PrintReport" will not refresh the report format while printing.
<2> printReportOptions.AddPrinterPageRange("from page number", "to page number") can set printing range.
<3> printReportOptions.PrinterName is to set printer name.
<4> if user want to refresh report to match physical printer setting, please use CR.designer to format it firstly, then use "PrintReport" to print.

2. Use original method "PrintToPrinter" from CR.NET if user don't need print A4 with minimal margins.

Note: for Cr for VS 2010/2012/2013 use the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP BusinessObjects\Suite XI 4.0\Crystal Reports\DesignerOptions

For 32 bit OS remove \wow6432Node.

 If not able to use RAS then update the Reports with the minimum margin of .166

For info on how to replace the Viewers print button with your own see this KBA -  1765153

See Also

KBA:  1345377 - Crystal Reports 2008 report cannot be printed in the small scale from Visual Basic .NET application

Keywords

  • Page Scaling issue when printing from the .NET Winform Application
  • Page Scaling issue when printing
  • Printout from the .NET Winform Application is different of the one from Crystal Report Designer Application
  • different printout between .NET and crystal Report Designer.
  • .NET printout.
, KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , BI-DEV , Business Intelligence Software Development Kits (SDKs) , Problem

Product

Crystal Reports 2008 V1 ; SAP Crystal Reports, developer version for Microsoft Visual Studio

Attachments

testmyprinter.zip