Solved

Help Me, Printing Problem

Posted on 1999-01-06
2
191 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
Comment Utility
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
Comment Utility
Thanks you.


0

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

Suggested Solutions

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

743 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

12 Experts available now in Live!

Get 1:1 Help Now