Discussion Locked

Change printer.orientation to landscape

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am looking to change the user's default printer page layout to landscape, conditionally, using active-x or a java applet. Anyone have any thoughts as to how to do this?

1 reply

by steved

From the Knowledge Base:

SUMMARY
PageSet.exe is a self-extracting executable file that contains a DLL file that allows you to programmatically change the printer orientation.

The following files are available for download from the Microsoft Download Center.

Pageset.exe
Release Date: Apr-13-1999

On Windows NT and Windows 2000 systems, PageSet.dll requires administrative access to your printer settings. Then you can incorporate the DLL into your application.

Use the Regsvr32.exe file to register the Pageset.dll as follows:

regsvr32.exe \pageset.dll
Reference the Pageset.dll in your application project.

The following code sets your paper orientation to landscape prior to printing or showing the report. Paste the following code in the General Declaration section of your form:

Dim obj As PageSet.PrinterControl

Private Sub Command1_Click()
On Error GoTo errorhandler:
Set obj = New PrinterControl
obj.ChngOrientationLandscape
DataReport1.Show
DataReport1.PrintReport False, rptRangeFromTo, 1, 1

Exit Sub

errorhandler:
MsgBox Err.Description
obj.ReSetOrientation

End Sub

Private Sub Form_Unload(Cancel As Integer)

obj.ReSetOrientation 'This resets the printer to portrait.

End Sub

NOTE: In the preceding application you are resetting the printer in the Form_Unload event. The printer must be reset back to the default orientation. Ifnot, any print job sent to the network printer will be printed using the orientation set by your program.

This discussion is closed to new replies.