Romias
Romias

Reputation: 14133

Different orientation in a Multiple page PrintDocument (How to)

I have a PrintDocument that has several pages. One page in that document must be in a Landscape orientations instead of Portrail.

As the PrintPage event is triggered for each page on the document... at the very begining of that event handler I set the PrintPageEventArgs.PageSettings.Landscape to true.

That doesn't works on THAT page... but I can see that Landscape is set to true and taked into account in the NEXT page.

I assume that somehow... after the event is triggered for a certain page you are not able to change the page orientation. That is more of less logic if you think it... but HOW COULD I SET THAT FLAG before EVENT fires in a multiple page PrintDocument?

Note: I don't know in advance if the "next" page will going to actually need a Landscape orientation.

Upvotes: 5

Views: 7201

Answers (1)

Phil Price
Phil Price

Reputation: 2313

I'm no expert at printing in .NET; however using Reflector; it looks like you might want to handle the QueryPageSettings event on PrintDocument. It looks like PrintController's private PrintLoop() method, will invoke events in this order for each page:

  1. QueryPageSettings
  2. StartPage
  3. PrintPage
  4. EndPage

Hope this helps.

Upvotes: 7

Related Questions