Symptom
- The report designed in custom paper size (Width 8 inch x Height 4 inch) cannot be printed as original paper orientation
- Paper orientation setting is ignored
- The report is cut off by 4 inch
Reproducing the Issue
- Open Printers and Faxes from Windows Operating System (OS).
- Click File > Server Properties.
- Click Forms tab.
- Check Create a new form.
- Type Form name. (i.e. 8x4)
- Select "English" as Units in the Form Description.
- Type 8 inch as Width of Paper size.
- Type 4 inch as Height of Paper size.
- Click Save Form.
- Click Close.
- Launch Crystal Reports 2008.
- Click File > New > Blank Report.
- Click Cancel in the Database Expert window.
- Click File > Page Setup.
- Select a specific Printer (i.e. Microsoft XPS Document writer) which is able to print the custom paper size.
- Check Dissociate Formatting Page Size and Priter Paper Size.
- Select customer paper size (i.e. 8x4) you create.
- Select "Portrait" in the Orientation.
- Click OK.
- Design the report.
- Click File > Save As.
- Type File name and click Save.
- Print the report from .NET application.
- Crystal Reports 2008 SP1 Fix Pack 1.2 or later
- Visual Studio 2005
- Visual Studio 2008
Here is the sample VB code to print out.
Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
myReport.Load("C:\custompapersize8x4.rpt")
Dim myPrintOptions As PrintOptions = myReport.PrintOptions
myPrintOptions.PrinterName = "Microsoft XPS Document Writer"
myPrintOptions.PaperOrientation = PaperOrientation.Portrait
' 119 is the value of custom paper size (8x4 inch) in the local Windows OS.
myPrintOptions.PaperSize = CType(119, PaperSize)
myReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True
myReport.PrintToPrinter(1, False, 1, 1)
Resolution
To print the report in proper paper orientation, use the following steps and VB.NET code.
- Create a new custom paper size (Width: 4 inch x Height: 8 inch).
- Set the value of custom paper size (Width: 4 inch x Height: 8 inch).
Dim myReport As New CrystalDecisions.CrystalReports.Engine.ReportDocument
myReport.Load("C:\custompapersize8x4.rpt")
Dim myPrintOptions As PrintOptions = myReport.PrintOptions
myPrintOptions.PrinterName = "<PRINTER NAME>"
myPrintOptions.PaperOrientation = PaperOrientation.Portrait
' 120 is the value of custom paper size (4x8 inch) in the local Windows OS.
myPrintOptions.PaperSize = CType(120, PaperSize)
myReport.PrintOptions.DissociatePageSizeAndPrinterPaperSize = True
myReport.PrintToPrinter(1, False, 1, 1)
Keywords
user defined paper size, devcap.exe, Microsoft XPS Document Writer, VS2005, VS2008, CR2008 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem