SAP Knowledge Base Article - Public

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

Symptom

  • Cannot print the report in the small scale using PrintToPrinter method
  • The report is cut off by the width of actual printer paper size

Reproducing the Issue

  1. Create a new report using B4 paper size and landscape orientation.
  2. Print out the report in the small scale using the code below from a Visual Basic .NET application.

Dim crReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim myPrintOptions As CrystalDecision.CrystalReports.Engine.PrintOptions = crReport.PrintOptions

' B4 paper size and landscape report 

crReport.Load("C:\B4Landscape.rpt") 

myPrintOptions.PrinterName = "<PRINTER NAME>"

' Set Landscape as paper orientation 

myPrintOptions.PaperOrientation = PaperOrientation.Landscape

' Set A4 printer paper size 

myPrintOptions.PaperSize = PaperSize.PaperA4

crReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True

crReport.PrintToPrinter(1, False, 1, 1)

  • Crystal Reports 2008 V1 + Fix Pack 1.3 or later
  • Microsoft Visual Studio 2005
  • Microsoft Visual Studio 2008

Resolution

To print the report in the small scale, use the following code.

Dim crReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument

Dim myPrintOptions As CrystalDecision.CrystalReports.Engine.PrintOptions = crReport.PrintOptions 

' B4 paper size and landscape report 

crReport.Load("C:\B4Landscape.rpt") 

crReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True

Dim myPrintLayoutSettings As New CrystalDecisions.Shared.PrintLayoutSettings

Dim myPageSettings As New System.Drawing.Printing.PageSettings

Dim myPrinterSettings As New System.Drawing.Printing.PrinterSettings

myPrinterSettings.PrinterName = "<PRINTER NAME>"

myPrinterSettings.Copies = 1 

myPrintLayoutSettings.Scaling = PrintLayoutSettings.PrintScaling.Scale

For Each ps As System.Drawing.Printing.PaperSize In myPrinterSettings.PaperSizes

' The exact same paper size name should be set depends on selected printer name 

    If ps.PaperName = "A4" Then

       myPageSettings.PaperSize = ps

    End If 

Next

crReport.PrintToPrinter(myPrinterSettings, myPageSettings, False, myPrintLayoutSettings)

Keywords

PrintReport, ShrinkOnly, DoNotScale, Microsoft XPS Document Writer, ModifyUserPaperSize, devcap.exe , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

Crystal Reports 2008 V1