Print ORIENTATION: Selecting it from common dialog? 
Author Message
 Print ORIENTATION: Selecting it from common dialog?

I am kind enough to .SHOW the printer dialog, allowing the user to
configure the printing to his preference. :o)

But the user then clicks on the Properties Button and changes the print
orientation to landscape.  :-)

How can I get my code to know this? :~)

I posted a similar message last week but in a few days it was gone.
Sorry if I missed a reply.  :o(

Guy Doucet



Sun, 11 Nov 2001 03:00:00 GMT  
 Print ORIENTATION: Selecting it from common dialog?
check printer.orientation
This may not work on NT due to a bug, but there is an article on the ms KB
on how to work around this.

Quote:

> I am kind enough to .SHOW the printer dialog, allowing the user to
> configure the printing to his preference. :o)

> But the user then clicks on the Properties Button and changes the print
> orientation to landscape.  :-)

> How can I get my code to know this? :~)

> I posted a similar message last week but in a few days it was gone.
> Sorry if I missed a reply.  :o(

> Guy Doucet

--
Robert Gelb
Data Express


Sun, 11 Nov 2001 03:00:00 GMT  
 Print ORIENTATION: Selecting it from common dialog?
Yes you are correct on the Printer.Orientation property but only partly, I
think?   :o)
I did a little bit of testing and found this:

I can use the printer dialog and allow the user to select the printing
orientation. Then I can check the result using the Printer.Orientation
property, and it works. But if I specify the printing orientation myself using
the Printer.Orientation property, it no longer works. For instance, I tried to
preset the printing orientation by setting the Printer.Orientation property
just before .SHOWing the printer dialog. First of all, I can't seem to preset
the orientation this way, and to top it off, the Printer.Orientation always
returns what I preset it to, no matter what you select in the printer dialog
thereafter. I have tried Printer.Enddoc, Killdoc, and more but to no avail. If
I stop my application and restart it, then I starts responding correctly
(until I set the property again).

Any more Ideas? I'll take whatever information you are willing to offer -
thank you.
Guy Doucet

Robert Gelb a crit :

Quote:
> check printer.orientation
> This may not work on NT due to a bug, but there is an article on the ms KB
> on how to work around this.


> > I am kind enough to .SHOW the printer dialog, allowing the user to
> > configure the printing to his preference. :o)

> > But the user then clicks on the Properties Button and changes the print
> > orientation to landscape.  :-)

> > How can I get my code to know this? :~)

> > I posted a similar message last week but in a few days it was gone.
> > Sorry if I missed a reply.  :o(

> > Guy Doucet

> --
> Robert Gelb
> Data Express



Mon, 12 Nov 2001 03:00:00 GMT  
 Print ORIENTATION: Selecting it from common dialog?
As far as I am aware, as soon as you access the VB Printer Object in any way
(such as using Printer.Print or by simply setting one of its properties such
as Printer.Orientation) then VB sets up for itself a Printer Object whose
details it gets from the system's Default Printer settings as held in the
registry, and it holds these settings until you use an EndDoc statement to
print your output and "kill" the object. This means that, under such
circumstances, any changes which the user makes in the CommonDialog will be
ignored by the VB Printer Object. If you want the VB Printer Object to
reflect the changes made by the user in the CommonDialog then you need to
makes sure that you do not access the Printer Object in any way (since the
start of your application or the last EndDoc command) before calling the
CommonDialog. You also need to make sure that the user's selections are used
by VB to change the system's registry settings. To do this you should ensure
that CommonDialog1.PrinterDefault = True (which is the default setting of
the CommonDialog). Then, once the CommonDialog has been closed, the first
access to the VB Printer Object will cause it to get the user's settings
from the registry. All of this means that providing you do not access the
Printer Object in wany way (since the last EndDoc) before calling the
CommonDialog then you can get your code to know what changes the user
makes - but you cannot "pre-set" the orientation or other similar value.
(Unless, of course, you use Windows API calls, which are capable of peeling
oranges with a wet rag!)

Mike

Quote:

>Yes you are correct on the Printer.Orientation property but only partly, I
>think?   :o)
>I did a little bit of testing and found this:

>I can use the printer dialog and allow the user to select the printing
>orientation. Then I can check the result using the Printer.Orientation
>property, and it works. But if I specify the printing orientation myself
using
>the Printer.Orientation property, it no longer works. For instance, I tried
to
>preset the printing orientation by setting the Printer.Orientation property
>just before .SHOWing the printer dialog. First of all, I can't seem to
preset
>the orientation this way, and to top it off, the Printer.Orientation always
>returns what I preset it to, no matter what you select in the printer
dialog
>thereafter. I have tried Printer.Enddoc, Killdoc, and more but to no avail.
If
>I stop my application and restart it, then I starts responding correctly
>(until I set the property again).

>Any more Ideas? I'll take whatever information you are willing to offer -
>thank you.
>Guy Doucet
>snip<



Mon, 12 Nov 2001 03:00:00 GMT  
 Print ORIENTATION: Selecting it from common dialog?
Thank you to both of you. You were both correct. It just took me a while because
of some unexpected result. But here is more info.

Printer.Orientation = 2
Printer.EndDoc
Debug.Print Printer.Orientation (still always 2)

Printer.Orientation = 2
Printer.Print
Printer.EndDoc
Debug.Print Printer.Orientation (now goes back to default)

You must send something to the printer (even if it is a zero length string), and
only then will the EndDoc and KillDoc methods reset the values.
G.Doucet

Mike Williams a crit :

Quote:
> As far as I am aware, as soon as you access the VB Printer Object in any way
> (such as using Printer.Print or by simply setting one of its properties such
> as Printer.Orientation) then VB sets up for itself a Printer Object whose
> details it gets from the system's Default Printer settings as held in the
> registry, and it holds these settings until you use an EndDoc statement to
> print your output and "kill" the object. This means that, under such
> circumstances, any changes which the user makes in the CommonDialog will be
> ignored by the VB Printer Object. If you want the VB Printer Object to
> reflect the changes made by the user in the CommonDialog then you need to
> makes sure that you do not access the Printer Object in any way (since the
> start of your application or the last EndDoc command) before calling the
> CommonDialog. You also need to make sure that the user's selections are used
> by VB to change the system's registry settings. To do this you should ensure
> that CommonDialog1.PrinterDefault = True (which is the default setting of
> the CommonDialog). Then, once the CommonDialog has been closed, the first
> access to the VB Printer Object will cause it to get the user's settings
> from the registry. All of this means that providing you do not access the
> Printer Object in wany way (since the last EndDoc) before calling the
> CommonDialog then you can get your code to know what changes the user
> makes - but you cannot "pre-set" the orientation or other similar value.
> (Unless, of course, you use Windows API calls, which are capable of peeling
> oranges with a wet rag!)

> Mike


> >Yes you are correct on the Printer.Orientation property but only partly, I
> >think?   :o)
> >I did a little bit of testing and found this:

> >I can use the printer dialog and allow the user to select the printing
> >orientation. Then I can check the result using the Printer.Orientation
> >property, and it works. But if I specify the printing orientation myself
> using
> >the Printer.Orientation property, it no longer works. For instance, I tried
> to
> >preset the printing orientation by setting the Printer.Orientation property
> >just before .SHOWing the printer dialog. First of all, I can't seem to
> preset
> >the orientation this way, and to top it off, the Printer.Orientation always
> >returns what I preset it to, no matter what you select in the printer
> dialog
> >thereafter. I have tried Printer.Enddoc, Killdoc, and more but to no avail.
> If
> >I stop my application and restart it, then I starts responding correctly
> >(until I set the property again).

> >Any more Ideas? I'll take whatever information you are willing to offer -
> >thank you.
> >Guy Doucet
> >snip<



Mon, 12 Nov 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Selecting what printer to print to with the common dialog control

2. How to use Print Common Dialog to send output to selected printer

3. Can't Set Printer Orientation w/Common Dialog

4. Can't set printer orientation w/Common Dialog

5. Changing Page Orientation without Common Dialog

6. Question about the Common Dialog print dialog control

7. Try Again: How to change the printer in the Print Dialog of the Common Dialog

8. print dialog w/o common dialog

9. Microsoft Common Dialog Control 6.0 Problem (Print Dialog)

10. Common Dialog Print Dialog Portion

11. Print Dialog - Paper Orientation

12. How to print after selecting printer from Print Dialog

 

 
Powered by phpBB® Forum Software