Groups | Blog | Home
all groups > dotnet drawing api > january 2005 >

dotnet drawing api : Printing from a Windows Service



Paul Wardle
1/28/2005 4:37:58 PM
Hi

I am trying to print a document from a Windows Service

Eveything works, apart from I can't set the page settings into Landscape! It
always prints portrait.

If I host my code in a normal app (not a Windows Service) it works OK!

Could this be a security issue? I see that Microsoft use ResetDC to set the
page options. However, no exception is thrown - so this method does not
fail.

I tried running the Windows Service under my own login account, but to no
avail.

The code is below...any ideas....?

Thanks

Paul Wardle




private void QueryPageSettings(object sender, QueryPageSettingsEventArgs e)
{

e.PageSettings.Landscape = this.Landscape;

}

Nate Smith
2/3/2005 12:19:41 PM
I am printing landscape pages from within a service with no problem. I am
setting the e.PageSettings.Landscape to true or false in the OnPrintPage
handler as well as on the QueryPageSettings. I have had little luck setting
things in QueryPageSettings, btw. For instance, you can't set the Duplex
property from within the QueryPageSettings handler. So I don't actually
know if that is doing the trick, but if you set it within the PrintPage
handler, it should work.

Hope this helps,
Nate Smith

private void OnPrintPage( object obj, PrintPageEventArgs e )

{

......

e.PageSettings.Landscape = true;

.....

}


[quoted text, click to view]

Paul Wardle
2/3/2005 7:26:22 PM
Thanks, I'll try that...


[quoted text, click to view]

AddThis Social Bookmark Button