Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

I have a report in VB.NET VS2013 that is 8.5" x 5.5" or half page of short bond, before updating to 13.0.14.1720, I can print it successfully without problem

Before:

        PrinterLibrary.PrinterLib.SetCustomPaperSize(My.Settings.ORPRINTER, "HALFPAGE")

        rpt.PrintOptions.PrinterName = My.Settings.ORPRINTER

        rpt.PrintOptions.PaperSize = CType(PrinterLibrary.PrinterLib.GetCustomForm(My.Settings.ORPRINTER, "HALFPAGE"), PaperSize)

        rpt.PrintToPrinter(1, True, 1, 0)

The above code prints my report using a continuous paper without a problem, but after I upgraded, to the latest version, my report is automatically printed in landscape. So I read issues in forums and found out RAS SDK to solve my automatic landscape problem

New Code:

Dim rptClientDoc As CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument

Dim printReportOptions As New CrystalDecisions.ReportAppServer.Controllers.PrintReportOptions()

Dim newOpts As New CrystalDecisions.ReportAppServer.ReportDefModel.PrintOptions()

ptClientDoc = rpt.ReportClientDocument

newOpts.DissociatePageSizeAndPrinterPaperSize = True

newOpts.PrinterName = My.Settings.ORPRINTER

newOpts.DriverName = "winspool"

newOpts.PaperSize = CType(PrinterLibrary.PrinterLib.GetCustomForm("EPSON LQ-300+ /II ESC/P 2", "HALFPAGE"),                     CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSizeEnum)

printReportOptions.PrinterName = My.Settings.ORPRINTER

printReportOptions.AddPrinterPageRange(1, rpt.Rows.Count)

printReportOptions.PaperSize = CType(PrinterLibrary.PrinterLib.GetCustomForm(My.Settings.ORPRINTER, "HALFPAGE"), CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperSizeEnum)

newOpts.DissociatePageSizeAndPrinterPaperSize = True

rptClientDoc.PrintOutputController.ModifyPaperOrientation(CrystalDecisions.ReportAppServer.ReportDefModel.CrPaperOrientationEnum.crPaperOrientationPortrait)

rptClientDoc.PrintOutputController.ModifyPrintOptions(newOpts)

rptClientDoc.PrintOutputController.PrintReport(printReportOptions)

The above code prints in portrait now and fits in 8.5 x 5.5, but for multiple pages, it will skip the other half, as if it treats the report as 8.5x11 inches.

My problem now, is how can I print it without feeding the other half.

Thank you.

Labels in this area