PEGetSelectedPrinter replacement using RDC

Posted on 2004-11-08
Medium Priority
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

vidru earned 2000 total points
ID: 12526673
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

749 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