cancel
Showing results for 
Search instead for 
Did you mean: 

Printing a single page from multiple pages using Crystal Reports Viewer

KT-bt31
Explorer
0 Kudos
337

Please tell us how to print only one specified page from a multi-page document
using Crystal Report Viewer in a Windows 11.
Printing is done by selecting the [Print] button in Crystal Report Viewer.
To print, use the Windows print dialog to specify the pages.
We want to print the page we want to print without previewing it in Crystal Report Viewer,
but even if we specify a page, the previewed page gets printed.
We can print multiple pages as specified, but we cannot print just one page.

Our development environment is as follows.

Windows 11 Pro(23H2)
Microsoft Visual Studio 2022(64bit)Version 17.13.0
Microsoft .NET Framework 4.8
SAP Crystal Reports 2020 SP4 Patch100(64bit)
SAP Crystal Reports, version for Microsoft Visual Studio(SP37)(64bit)
SAP Crystal Reports for Visual Studio(SP37) CR_runtime(64bit)
SAP Crystal Reports for Visual Studio(SP37) Merge Modules(64bit)

In addition, in a Windows 10, we could print just one page.

View Entire Topic
DonWilliams
Active Contributor
0 Kudos

Hello,

OK now I see the new Windows 11 print dialog box, not sure why when I googled it the first time nothing was found...

I suggest moving back to the legacy Dialog boxes, I doubt R&D has done anything to use the new one. Therefore there is no way to set the values in code and you are limited to what the New Printer UI allows, it could be a bug in Microsoft's UI, you'll have to ask MS how to set values....

To set it back to the original see this https://www.winhelponline.com/blog/restore-legacy-print-dialog-windows-11/

FYI - Using the CR Basic to print reports doesn't work that well to make changes to the printer saved in the RPT File. I suggest you have a look at my printer test app to use the PrintOutputController() to set printer info, it does require using RAS to open the report object. My sample shows you how to do this.

I will ping R&D and see what they say about it and if there are any plans to integrate it into CR's Printer dialog boxes.

Sorry about not seeing this sooner...

DonWilliams
Active Contributor
0 Kudos

More info from SAP R&D:

In the Project you can change the default print button to use PrintToPrinter or PrintOutputController:

DonWilliams_0-1742518495658.png

Info from R&D:

In Page Range, if you specified the single page number, then it will always printed out the current viewing page in the viewer. But if you specified the page range, it could successfully print out the correct pages.

The PrintOutputController print dialog works well on Win11 24H2 since it’s used our CR print dialog, and also CRW works well.

As workaround, user could change to use PrintOutputController printmode in winform viewer, there’s registry:

  •          32 bit runtime: [HKEY_LOCAL_MACHINE\SOFTWARE\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports for .NET] 
  •          64 bit runtime: [HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Crystal Reports for .NET] 

Add "PrintMode" as String value:

  •          If the value is set to "PrintToPrinter", the WinForm will use PrintToPrinter to print the report. 
  •          If the value is set to "PrintOutputController", the WinForm will use PrintOutputController to print the report. 
  •          If other value is set, this key will not take effect.
  •          Both "PrintToPrinter" and "PrintOutputController" are case insensitive.
  •          This key will override the “PrintMode” set in Crystal Reports Viewer property page.

Or User could add below registry key value to switch to the legacy print dialog for All app:

[HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog]

"PreferLegacyPrintDialog"=dword:00000001

There's already lots of discussions regarding new print dialog in Win11 on internet and you could see there are many issues with it.

R&D will continue to look into a possible fix or wait to see if Microsoft "fixes" anything.

So for now all SAP can suggest is to not use the new Windows Dialog box and move back to the legacy dialog boxes.

Thanks again

Don

KT-bt31
Explorer
0 Kudos

Hi, DonWilliams.

Sorry for the late reply.
And your explanation helped me understand the situation.
We will try your advice.

Thank you, DonWilliams.