Question How do I setup file orientation for documents to print

yorke_gvg

New member
Joined
Jul 21, 2023
Messages
1
Programming Experience
1-3
I'm creating VB application where i want to print documents, but all of my documents have diffirent orientation, some of them are in Portret orientation and some of them are in Landscame.

I have a function where user can print bunch of files, like more then one which have different orientation.

This is the code which i use to set the settings of the printer programatically:

VB.NET:
Dim Printers As PrinterSettings.StringCollection

Printers = printerSettings.InstalledPrinters

Dim printerSettings As New PrinterSettings

printerSettings.DefaultPageSettings.PaperSize = pageSettings.PaperSize
printerSettings.DefaultPageSettings.PrinterResolution = pageSettings.PrinterResolution
printerSettings.DefaultPageSettings.Color = pageSettings.Color
printerSettings.DefaultPageSettings.Landscape = pageSettings.Landscape
printerSettings.DefaultPageSettings.PrinterSettings = printerSettings.DefaultPageSettings.PrinterSettings
printerSettings.DefaultPageSettings.PaperSource = pageSettings.PaperSource


I can setup the orientation here: pageSettings.Landscape, but it will be only Landscape or only Portrait. I want to be automatically detected?

Is that possible?

If not, is there a way to check file orientation before print the file programatically with VB?

What I have tried:

I try to add auto to the: pageSettings.Landscape but it accepts only true/false.
 
Last edited by a moderator:
Automatically detected from what?

BTW, given that you can preview your post, please don't submit it if your formatting is a mess. If you'd like us to read your code, take the time and make the effort to make it easily readable.
 
Back
Top