Solved

Help Me, Printing Problem

Posted on 1999-01-06
2
193 Views
Last Modified: 2012-08-13
Can anyone tell me if there is a way to force a print to come out in Landscape instead of Portrait. I'm Using Crystal Report Activex Control in V.B 5.0 and can't print in Landscape Orintation when the defaul orintation is Portrait
0
Comment
Question by:diego_mendoza
2 Comments
 

Accepted Solution

by:
torsk earned 100 total points
ID: 1454175
I think you have to start the report whith code:

Public Sub OpenTheReport( ByRef CurrentFrm As Form)
On Error GoTo ErrorHandler
    Dim Result%, jobnum%, mainjob%, dialogflag%, resultlong&
    Dim JobInfo As PEJobInfo, TempText$
    Dim PrintData As Printer
    Dim crDEVMODE As DevMode
    Dim HasSavedData As Long
    Dim PrintOptions As PEPrintOptions
    Dim Msg As String
       
    Result% = PEOpenEngine()
    If Result% = 0 Then
        HourGlass False
        MsgBox "Cant get conntact with Crystal Report!",
        vbOKOnly + vbCritical, "Systemerror"
        Exit Sub
    End If

    JobInfo.StructSize = PE_SIZEOF_JOB_INFO
    jobnum% = PEOpenPrintJob("RepeortFilename")
       
    crDEVMODE.dmOrientation = 1 'or 2 this change the
                                 orientation
    crDEVMODE.dmDeviceName = "RptDeviceName"   'printername
    crDEVMODE.dmSpecVersion = &H320 'version of the DEVMODE
                               structure Win32
    crDEVMODE.dmSize = 68                              
    crDEVMODE.dmFields = &H1
    Result% = PESelectPrinter(jobnum%, "DriverName",
    "DeviceName", "Port", crDEVMODE)
   
    PrintOptions.StructSize = PE_SIZEOF_PRINT_OPTIONS
    Result% = PEGetPrintOptions(jobnum%, PrintOptions)
    PrintOptions.StartPageN = Rpt.RptFraSide
    PrintOptions.stopPageN = Rpt.RptTilSide
    PrintOptions.nReportCopies = Rpt.RptKopier
    Result% = PESetPrintOptions(jobnum%, PrintOptions)
   
    If Rpt.RptPreview Then  
        Result% = PEOutputToWindow(jobnum%, Rpt.RptTittel, 0, 0, Screen.Width, Screen.Height, WS_MAXIMIZE + WS_SYSMENU + WS_MAXIMIZEBOX + WS_THICKFRAME, 0)
        Result% = PEStartPrintJob(jobnum%, True)       uforutsette resultater
       
        If Result% = 0 Then
            Msg = "Error"
            ShowErrMsg (Msg)
            GoTo Avslutt
        End If
       
        Result% = 1
        Do While Result% <> 0
            DoEvents
            Result% = PEGetWindowHandle(jobnum%)
        Loop
    Else                    
        Result% = PEEnableProgressDialog(jobnum%, True)
        Result% = PESetDialogParentWindow(jobnum%, CurrentFrm.hwnd)
        Result% = PEOutputToPrinter(jobnum%, Rpt.RptKopier)
        Result% = PEStartPrintJob(jobnum%, True)            

        Result% = PEGetJobStatus(jobnum%, JobInfo)
        Select Case Result%
            Case PE_JOBNOTSTARTED
                TempText$ = "Cant start"
            Case PE_JOBINPROGRESS
                TempText$ = "Printing"
            Case PE_JOBCOMPLETED
                TempText$ = "Printing ready"
            Case PE_JOBFAILED
                TempText$ = "Error"
            Case PE_JOBCANCELLED
                TempText$ = "Cancel printing"
        End Select
       
        If Result% <> PE_JOBCOMPLETED Then MsgBox TempText, vbInformation + vbOKOnly
       
    End If
       
    GoTo Avslutt
   
ErrorHandler:
    HourGlass False
    ShowErrMsg
Avslutt:
    PEClosePrintJob jobnum%
    PECloseEngine
    HourGlass False
End Sub
0
 

Author Comment

by:diego_mendoza
ID: 1454176
Thanks you.


0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

773 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