Anoop
Anoop

Reputation: 438

Page orientation in print dialog does not persists the setting

I am doing a VB 3.0 to .Net conversion project, which has got some printing activities.

Now the user is given a print setup dialog, where they used to set page orientation and other settings for the printer.

The issue here is that the page orientation, when set from .net printdialog always seems to reset once the application is closed and opened again. In other words, user opens the application, sets the orientation from print orientation from portrait to landscape, does some printing and closes the application. now when open the application back the print orientation is portrait again!!(while user expected it to be landscape).

In vb 3.0 commondialog with some flag is used, and it is working well.

can some one please guide.

Appreciate any help.

Upvotes: 1

Views: 2282

Answers (1)

AndrewR
AndrewR

Reputation: 6758

I'm not sure about VB3, but are you sure it's not saving that setting somewhere?

You can set the print direction in code.

PrintDialog pDialog = new PrintDialog();
pDialog.PrintTicket.PageOrientation = PageOrientation.Lanscape;

You should also be able to catch if the user changes the orientation on the print dialog so you can save which option they pick.

pDialog.PrintTicket.PropertyChanged += new PropertyChangedEventHandler(PrintPropertyChanged);

private void PrintPropertyChanged(object sender, EventArgs e){
    PageOrientation SelectedPageOrientation = pDialog.PrintTicket.PageOrientation;
    //save the orientation, or save the entire PrintTicket if you want.
}

(I didn't test this out, but should be pretty close.)

Upvotes: 2

Related Questions