1. RE: landscape printing
Greg Haberek wrote:
>
>
> Couldn't you check to size of the page, and if the x > y, then it's
> landscape, and if the x < y then it's portrait? If its not what you
> want,
> tell the user to change it and try again. I did this in a program I
> wrote.
>
> ----- Original Message -----
> From: "Ron Austin" <ronaustin at alltel.net>
> To: <EUforum at topica.com>
> Subject: landscape printing
>
>
> > I have searched through the forum and the documentation and can't find
> > any way to tell the printer to print in landscape mode. I don't want to
> > rely on the operator selecting landscape mode, because they will
> > probably forget. Is there a way to force the printer into landscape
> > mode, and if so, how do I do it?
> >
> >
> > TOPICA - Start your own email discussion group. FREE!
> >
> >
> Reply to Greg, from Ron
Checking the orientation and poping up a message is a good idea, but I
would really like to be able to set the orientation myself, and maybe
some other features, like number of pages, as well.
2. RE: landscape printing
Well, it's been two weeks since I originally asked the question about
forcing the windows printer into landscape mode. I wish Derek or one of
the other smart people out there would change win32lib.ew so you could
tell the printer to print landscape or portrait.
>
>
> Greg Haberek wrote:
> >
> >
> > Couldn't you check to size of the page, and if the x > y, then it's
> > landscape, and if the x < y then it's portrait? If its not what you
> > want,
> > tell the user to change it and try again. I did this in a program I
> > wrote.
> >
> > ----- Original Message -----
> > From: "Ron Austin" <ronaustin at alltel.net>
> > To: <EUforum at topica.com>
> > Sent: Thursday, December 11, 2003 10:15 PM
> > Subject: landscape printing
> >
> >
> > > I have searched through the forum and the documentation and can't find
> > > any way to tell the printer to print in landscape mode. I don't want to
> > > rely on the operator selecting landscape mode, because they will
> > > probably forget. Is there a way to force the printer into landscape
> > > mode, and if so, how do I do it?
> > >
> > >
> > > TOPICA - Start your own email discussion group. FREE!
> > >
> > >
> > Reply to Greg, from Ron
> Checking the orientation and poping up a message is a good idea, but I
> would really like to be able to set the orientation myself, and maybe
> some other features, like number of pages, as well.
>
3. RE: landscape printing
Derek Parnell wrote:
>
>
> ----- Original Message -----
> From: "Ron Austin" <ronaustin at alltel.net>
> To: <EUforum at topica.com>
> Subject: RE: landscape printing
>
>
> > Well, it's been two weeks since I originally asked the question about
> > forcing the windows printer into landscape mode. I wish Derek or one of
> >
> > the other smart people out there would change win32lib.ew so you could
> > tell the printer to print landscape or portrait.
>
> If I knew I would have answered your query by now.
>
> Not answering either means I don't know or I did read your note. It
> never means I can't be bothered.
>
> I guess I'll read the manual (Windows API) and try to find out for you.
>
> --
> Derek
>
>I did not mean to imply that you can't be bothered. I appreciate what
>you, Euman, Judith, Pete and others have contributed to this forum.
>Although I have 20 years experiance writing code in Basic, I am at a
>complete loss when it comes to C and API. I hope to correct that, but
>until I do, I really need your help.
4. RE: landscape printing
Sorry, silly me. I thought this was a place to come and get help, not a
place where I would get lectured on programing practices.
Euman wrote:
>
>
> Hi,
>
> It also should be noted that win32lib is not ready for commercial
> application at present
> although great strides are being made by many to make it so but much
> more work is needed.
>
> I hope Derek will make his speach he makes (again) about this...
>
> If you dont know API then you will never understand how your program
> functions and this is
> what makes win32lib so volitile...(In my opinion)
>
> The Platform-SDK can be found here:
> http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
>
> Derek, Matt, Al, Robert Craig, Myself and many-many others (sorry to
> leave any API gurus out)
> have all had to read this, why not you?
>
> CreateDC
> The CreateDC function creates a device context (DC) for a device using
> the specified name.
>
> HDC CreateDC(
> LPCTSTR lpszDriver, // driver name
> LPCTSTR lpszDevice, // device name
> LPCTSTR lpszOutput, // not used; should be NULL
> CONST DEVMODE* lpInitData // optional printer data
> );-- The last CONST DEVMODE* lpInitData is provided below for
> you...DEVMODE
> The DEVMODE data structure contains information about the initialization
> and environment of a printer or a display device.
>
> typedef struct _devicemode {
> BCHAR dmDeviceName[CCHDEVICENAME];
> WORD dmSpecVersion;
> WORD dmDriverVersion;
> WORD dmSize;
> WORD dmDriverExtra;
> DWORD dmFields;
> union {
> struct {
> short dmOrientation;
> short dmPaperSize;
> short dmPaperLength;
> short dmPaperWidth;
> short dmScale;
> short dmCopies;
> short dmDefaultSource;
> short dmPrintQuality;
> };
> POINTL dmPosition;
> DWORD dmDisplayOrientation;
> DWORD dmDisplayFixedOutput;
> };
>
> short dmColor;
> short dmDuplex;
> short dmYResolution;
> short dmTTOption;
> short dmCollate;
> BYTE dmFormName[CCHFORMNAME];
> WORD dmLogPixels;
> DWORD dmBitsPerPel;
> DWORD dmPelsWidth;
> DWORD dmPelsHeight;
> union {
> DWORD dmDisplayFlags;
> DWORD dmNup;
> }
> DWORD dmDisplayFrequency;
> #if(WINVER >= 0x0400)
> DWORD dmICMMethod;
> DWORD dmICMIntent;
> DWORD dmMediaType;
> DWORD dmDitherType;
> DWORD dmReserved1;
> DWORD dmReserved2;
> #if (WINVER >= 0x0500) || (_WIN32_WINNT >= 0x0400)
> DWORD dmPanningWidth;
> DWORD dmPanningHeight;
> #endif
> #endif /* WINVER >= 0x0400 */
> } DEVMODE; Have fun!
>
> Euman
>
>
> ----- Original Message -----
> From: "Ron Austin" <ronaustin at alltel.net>
> To: <EUforum at topica.com>
> Sent: Saturday, December 27, 2003 8:14 AM
> Subject: RE: landscape printing
>
>
<snip>
5. RE: landscape printing
I think you will have to use escape codes to switch the printer
into the landscape mode. Derik I don't know how to use your library
to print so here is some of the code I think you need to use:
include win32lib.ew
include w32dll.ew
include w32gdi.ew
--
constant
xEscape = registerw32Function(gdi32,"Escape", {
C_ULONG, -- handle to device context
C_INT, -- escape function
C_INT, -- number of bytes in input structure
C_POINTER, -- pointer to input structure
C_POINTER }, -- pointer to output structure
C_INT) -- returns integer
--
constant
-- GDI esc code
PASSTHROUGH = 19,
-- HP DeskJet 800 series escape PCL printer codes
Portrait = { 027, 038, 108, 048, 079, 111 },
Landscape = { 027, 038, 108, 049, 079, 111 },
Reverse_Portrait = { 027, 038, 108, 050, 079, 111 },
Reverse_Landscape = { 027, 038, 108, 051, 079, 111 }
--
atom orient, Escape_size, printErr
object junk
orient = allocate(16)
--
procedure setPortrait()
mem_set(orient,0,16)
poke(orient,Portrait)
Escape_size = length(Portrait)
end procedure
--
procedure setLandscape()
mem_set(orient,0,16)
poke(orient,Landscape)
Escape_size = length(Landscape)
end procedure
--
-- setup orientation
setLandscape()
-- Tell the printer to go into that orientation
junk = w32Func(xEscape,{getDC(Printer),PASSTHROUGH,
Escape_size,orient,0})
You have to test this code in a program that you write
I have know way of being sure it will work.
I am not sure of the structure size and whether to use pokes or poke4
But this may get you going in the right direction.
Bernie
6. RE: landscape printing
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/aboutcommondialogboxes/pagesetupdialogbox.asp
The Page Setup dialog box lets the user set the following attributes of
the printed page:
* The paper type (envelope, legal, letter, and so on)
* The paper source (manual feed, tractor feed, sheet feeder, and so on)
* The page orientation (portrait or landscape)
* The width of the page margins
-- Brian
Derek Parnell wrote:
>
>
> ----- Original Message -----
> From: "Bernie Ryan" <xotron at bluefrognet.net>
> To: <EUforum at topica.com>
> Sent: Sunday, December 28, 2003 10:55 AM
> Subject: RE: landscape printing
>
>
> > I think you will have to use escape codes to switch the printer
> > into the landscape mode.
>
> Isn't this why God created device drivers?
>
> --
> Derek
>
7. RE: landscape printing
My intent was not to provide "news". I'm simply pointing to the
resource that anwsers the question.
The PAGESETUPDLG structure includes a DEVMODE structure which has a
dmOrientation member that can be either DMORIENT_PORTRAIT (1) or
DMORIENT_LANDSCAPE (2).
I'd provide a demo if it wasn't such a pain to init and properly fill
these stuctures... (you know... crashing your program 20 times before
getting it right; just to set one attribute.)
Maybe if I get really, really bored...
-- Brian
Derek Parnell wrote:
> Yes, we all know this already. This is not news. The question though was
> how does one code a program to place a printer into 'Landscape Mode' as
> opposed to getting a User to respond to a dialog box.
>
> It would appear that the program needs to set the appropriate data
> fields in the DEVMODE structure and use this somehow. I haven't spent a
> lot of time on this yet.
>
> --
> Derek