Link to home
Start Free TrialLog in
Avatar of Sanmarie
Sanmarie

asked on

Change Default Printer Settings in vb.net code

Using .Net 2.0, VS 2005, vb.net

I'm trying to print to a printer with setting defined in the attached vb.net code. The default settings of the printer is letter size with portrait orientation. I'm trying to print to legal size with landscape orientation but the attached code doesn't work. What am I doing wrong.

Thanks
San
Dim Printdoc As New Printing.PrintDocument
Dim SetPage As New System.Drawing.Printing.PageSettings
 
With SetPage
.PaperSource = PrintDoc.PrinterSettings.PaperSources(0)
.PaperSize.RawKind = Printing.PaperKind.Legal
.Landscape = True
End With
 
PrintDoc.DefaultPageSettings = SetPage

Open in new window

SOLUTION
Avatar of margajet24
margajet24
Flag of Singapore 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 Sanmarie
Sanmarie

ASKER

Thanks Margajet24,

I will try your code on Monday when I return to work. Will respond soon ...

San

Margajet24, it didn't work. It's still printing on letter size paper with portrait orientation.

San
ASKER CERTIFIED SOLUTION
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