PEGetSelectedPrinter replacement using RDC

Posted on 2004-11-08
Last Modified: 2008-01-09
Converting application from API to RDC and can't find a replacement for PEGetSelectedPrinter. Product is finished, need help ASAP!

Question by:BrianM_AZ
    1 Comment
    LVL 13

    Accepted Solution

    The Report object of the RDC has a SelectPrinter method:

    Sub SelectPrinter (pDriverName As String, pPrinterName As String, _
    pPortName As String)

    I sometimes use it in correlation with the CRViewer's PrintButtonClicked event:

    Private Sub Viewer_PrintButtonClicked(UseDefault As Boolean)

        UseDefault = False  'Don't use the default printer
        'CRPaperOrientation and CRPaperSize are Enumerated type _
            members of the CRAXDRT library
        Dim cOrientation As CRPaperOrientation
        Dim cSize As CRPaperSize
        'Get the report's current orientation and paper size
        cOrientation = crxRpt.PaperOrientation
        cSize = crxRpt.PaperSize
        crxRpt.PrinterSetup Me.hWnd     'Call the Printer Setup dialog

        'Loop through the Printers collection to ensure the correct _
            printer gets set for the report
        Dim p As Printer
        For Each p In Printers
            If p.DeviceName = crxRpt.PrinterName Then
                crxRpt.SelectPrinter p.DriverName, p.DeviceName, p.Port
                Exit For
            End If
        Next p

        'Reset the report's PaperOrientation and PaperSize properties _
            to override the "new" printer's defaults
        crxRpt.PaperOrientation = cOrientation
        crxRpt.PaperSize = cSize
        'Prompt the user for page numbers, copies, etc.
        crxRpt.PrintOut True, 1
        'To print directly to the printer, comment out the above line, _
            and uncomment the next line
        'crxRpt.PrintOut False, 1

    End Sub


    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
    Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now