Re: setPrintJobProperty problem

new topic     » goto parent     » topic index » view thread      » older message » newer message

Andy Drummond wrote:
> 
> CChris wrote:
> > 
> > Judith Evans wrote:
> > > 
> > > CChris wrote:
> > > > 
> > > > Andy Drummond wrote:
> > > > > 
> > > > > Back to printing problems.
> > > > > I can open the default printer and print to it with no worries.
> > > > > I had to declare printerDC to be global in w32Resources.ew, that was
> > > > > OK.
> > > > > I'm now trying to change the print orientation using:
> > > > > 
> > > > >   setPrintJobProperty(JP_Orientation, DMORIENT_LANDSCAPE)
> > > > > 
> > > > 
> > > > This just works for me, using a laser printer under WinXP Home.
> > > > Strange...
> Try</font></i>
> > > > calling it before getPrinter() perhaps.
> > > > 
> > > > CChris
> > > > 
> > > > > but I get no change in the output.
> > > > > Can anyone advise me on this? I tried calling the function immediately
> > > > > after
> > > > > assigning printerDC, and also after calling startDoc & startPage;
> > > > > still no
> > > > > go.
> > > > > If I still have to go to printer setup to do this then I might as well
> > > > > not
> be</font></i>
> > > > > opening the default printer....
> > > > > 
> > > > > AndyD
> > > 
> > > CChris, it would be nice if we didn't have to OK the Print screen as well
> > > as
> > > the print setup screen. I'd like to be able to run a program which uses
> > > getPrinter
> > > and VOID=setPrintJobProperty(JP_Orientation, DMORIENT_LANDSCAPE) and have
> > > the
> > > printer start printing my document in landscape without interaction on my
> > > part.
> > 
> > See the code I recently posted for a getDefaultPrinter() function; doesn't
> > it
> > do the job?
> > 
> > CChris
> 
> CChris,
> I think the trouble is that when you use getPrinter() to choose a printer,
> the code does more than just get a DC for the printer. I think it must load
> up a parameter block for it. So if I call getPrinter() and just click OK, the
> orientation control works fine. But if I use getDefaultPrinter() which gets
> the DC of the default printer, it does NOT do the same parameter getting &
> setting. Then the orientation control does nothing.  
> 

The idea indeed was that getDefaultPrinter() would set the default printer with
default attributes; the behaviour you got is what I expected. I didn't try
calling getDefaultPrinter() and then setPrintJobProperties(). If it doesn't work,
it would be worth making it work perhaps.

> I have replaced getDefaultPrinter() with getPrinter() and just clicked OK,
> and it is fine. Remove that and it is not.
> 
> I haven't looked at the getPrinter() code (well, I have, but the stuff just
> went in one eye and out the other) so I may be talking garbage; it wouldn't
> be the first time. But that seems to be the logical conclusion. Is it?
> 

Since getPrinterChoice() displays a dialog box where the user might change
settings, it has to check for these changes and make them effective for the
printer. That's a fair amount of code indeed.

> If so, should you add the getDefault Printer() to Win32Lib then I assume it
> would set things up exactly the same as getPrinter()+OK does. Then it will
> work fine. I can wait; it is not a great pain like the press shift once pain.
> 

The code I had posted was meant to be pasted in w32resources.ew, right after
getPrinterChoice(). It will be in 70.2 anyway, probably with the enhancements
suggested above.

> Is it possible to call getPrinter() with an argument which tells the routine
> the printer name to get or even just to imitate the press of OK for the
> default printer? Something like (DOS days) pushing a keypress onto the key
> stack before calling a routine which then gets the keypress & returns with
> no user input needed. A thought....

I think I'd rather add a selectPrinter(objet printer) procedure. If printer is a
sequence, it is a printer name string, and that will set designated printer as
current printer. If name is unknown, fall back on getPrinterChoice(). How about
that?

> 
> I appreciate your work on Win32Lib enormously - as I do Derek's work and
> I guess David Cuny's, who started it. You guys all want medals - or money -
> but not being Bill Gates's, you will get users complaining their model railway
> won't work right under Win32Lib or their printer keeps running out of ink or
> something silly like that.  
> 
> Tough life, isn't it. You do have many fans, though!
> 
> AndyD


I expect more complaints about printing for the weeks ahead actually. 
The lib had just so many print features that were offered, but didn't work. As
some start to, there will be more voices to ask for everything to work right out
of the box, and I cannot test everything because I have one computer and two
printers only (a laser and AdobePDF). That's why having a good pool of testers to
catch issues before release would tremendously help.

CChris

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu