Link to home
Start Free TrialLog in
Avatar of Ramesh Srinivas
Ramesh SrinivasFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Programmatically set print option to Landscape - crystal viewer...

Hi All,

I have been looking at ways to set the print layout to landscape programmatically (windows forms, crystal viewer). Does anyone know if this is possible? Would I need to create my own print button instead of the report viewers?

I found this, but not sure how to implement it for my scenario:

Private WithEvents myDocumentToPrint As PrintDocument

    Dim aPS As New PageSetupDialog
    aPS.Document = myDocumentToPrint
    '
    ' On the 1-rst call to the print dialog initialize the document's
    ' properties. On subsequent calls use what was previously set.
    '
    If Not myPageSetUp Then
        With aPS.Document.DefaultPageSettings
            .Margins.Top = 50
            .Margins.Left = 50
            .Margins.Right = 50
            .Margins.Bottom = 50
            .Landscape = True
        End With
    End If


I got this code from: http://www.thescarms.com/dotNet/PrintDataSet.asp

I appreciate any help on this.

regards,


KS
ASKER CERTIFIED SOLUTION
Avatar of Howard Cantrell
Howard Cantrell
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Ramesh Srinivas

ASKER

Thanks, that did the trick! Just need to find out what the parameters mean, as it only prints the first page!

                                             # of Copies,  collated as Boolean,     StartPage,        EndPage
crReportDocument.PrintToPrinter(     1,                     True,                    1,                 1)