cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the Printer to no printer dynamically

Former Member
0 Kudos

I was able to get the report print to a non-default (computer) default printer use the SelectPrinter Method if the report was save with "No Printer".

File->Page Setup

But I have lots of reports that exist in the wild and just a lot of reports here hundreds of them. Is there anyway to have the program do this?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Kalman;

No, there is not anyway to set no printer via the SDK.

Best Regards,

Jonathan

Answers (2)

Answers (2)

Former Member
0 Kudos

You can set the printer property to No printer at runtime using Report Design Component (RDC).

This is a duplicate thread and the question has been answered in:

[Click|;

Elaine

former_member184995
Active Contributor
0 Kudos

Hi Kalman,

You can check No Printer, but it is not a direct method call and I have only done it in .NET (it may also be available in Java) and you must use RAS.

Using RAS you essentially copy in print options from a No Printer report into the report that needs to have No Printer checked.

I have listed the code.

Good luck.

Jason

Imports CrystalDecisions.ReportAppServer.ClientDoc
Imports CrystalDecisions.ReportAppServer.Controllers
Imports CrystalDecisions.ReportAppServer.ReportDefModel
Imports CrystalDecisions.ReportAppServer.DataDefModel

Public Class WebForm1
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()

        Dim rdc As ReportClientDocument

        ' create report client document
        rdc = New ReportClientDocument

        ' set report application server location
        rdc.ReportAppServer = "127.0.0.1"

        ' create a new report based on the no printer checked report
        rdc.Open("C:\Reports\NoPrinterReport.rpt")

        ' copy out the print options from the no printer report
        Dim pOpts As PrintOptions
        pOpts = rdc.PrintOutputController.GetPrintOptions.Clone(True)

        ' create a report client document
        Dim rcd1 As ReportClientDocument
        rcd1 = New ReportClientDocument

        rcd1.ReportAppServer = "127.0.0.1"

        ' create a new report based on the report with a printer selected
        rcd1.Open("C:\Reports\PrinterReport.rpt")

        ' modify all of the print options and base them on the no printer reports print options and save
        rcd1.PrintOutputController.ModifyPrintOptions(pOpts)
        rcd1.PrintOutputController.ModifyPrinterName("")
        rcd1.PrintOutputController.ModifyPageMargins(pOpts.PageMargins.Left, pOpts.PageMargins.Right, _
                                                    pOpts.PageMargins.Top, pOpts.PageMargins.Bottom)
        rcd1.PrintOutputController.ModifyPaperOrientation(CrPaperOrientationEnum.crPaperOrientationDefault)
        rcd1.PrintOutputController.ModifyUserPaperSize(pOpts.PageContentHeight, pOpts.PageContentWidth)
        rcd1.Save()

    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
    End Sub

End Class

Edited by: Jason Everly on Oct 13, 2008 12:33 PM