1. Changing Default Printer Page Orientation & Size
- Posted by Rad <radhx at rediffmail.com> Mar 20, 2006
- 497 views
Hi, I have 4 reports, 2 with Portrait as Page Orientation and 2 with Landscape. They all differ in Page size too, A4, Letter, etc. getPrintChoice() is always invoked with default Printer setup for Orientation and Size, Portrait and A4 in my case. I tried setting up these 2 properties before invoking printer:
procedure setPaper(atom pDevMode) atom Memset, DevMode Memset = w32new_memset() DevMode = w32acquire_mem(Memset, SIZEOF_DEVMODE) poke(DevMode, peek({pDevMode, SIZEOF_DEVMODE})) w32store(DevMode, DEVMODE_dmOrientation, PaperOrient) w32store(DevMode, DEVMODE_dmPaperSize, PaperSize) poke(pDevMode, peek({DevMode, SIZEOF_DEVMODE})) w32release_mem(Memset) end procedure
But still the Printer dialogue is set to default. I would like to change these 2 default properties before invoking the Printer. Is is possible? Regards, Rad.
2. Re: Changing Default Printer Page Orientation & Size
- Posted by Derek Parnell <ddparnell at bigpond.com> Mar 20, 2006
- 473 views
Rad wrote: > > Hi, > > I have 4 reports, 2 with Portrait as Page Orientation and 2 with Landscape. > They all differ in Page size too, A4, Letter, etc. > > getPrintChoice() is always invoked with default Printer setup for > Orientation and Size, Portrait and A4 in my case. > > I tried setting up these 2 properties before invoking printer: > > }}} <eucode> > procedure setPaper(atom pDevMode) > atom Memset, DevMode > > Memset = w32new_memset() > DevMode = w32acquire_mem(Memset, SIZEOF_DEVMODE) > poke(DevMode, peek({pDevMode, SIZEOF_DEVMODE})) > > w32store(DevMode, DEVMODE_dmOrientation, PaperOrient) > w32store(DevMode, DEVMODE_dmPaperSize, PaperSize) > > poke(pDevMode, peek({DevMode, SIZEOF_DEVMODE})) > w32release_mem(Memset) > end procedure > </eucode> {{{ > > But still the Printer dialogue is set to default. The problem with your code is that it sets up a DevMode structure then deletes it ('w32release_mem') and doesn't pass it to the printer dialog. > I would like to change these 2 default properties before invoking > the Printer. Is is possible? Yes it is possible but not easy. You need to set up the complete PrintDlg struct and pass its memory address to getPrintChoice(). The library allows 'experts' to do stuff otherwise it uses basic defaults. I really need to get an intermediatary system going to allow easy updates of common items like those you mentioned. I'll add this to the todo list ... and seeing I'm redoing a lot of the printer stuff now, I'll see if I can quickly add it in. -- Derek Parnell Melbourne, Australia Skype name: derek.j.parnell