
Changing to landscape w/o EndDoc (yes I read the FAQ)
Can someone please help? I am trying to change the orientation of the
printer in the middle of a print job. My problem is that to do this, I
seem to need to send a Printer.EndDoc to make it take effect.
I would like to be able to do this without sending an EndDoc because the
application is used to fax documents, and if there is an EndDoc, the fax
needs to be set up w/ the phone number again since it is a "new" print
job. Also, when printing on a network, it caused extra print job
separators to be inserted whenever the orientation is changed.
Please help! Thanks...
Below is what appears in the MS VB Knowledge Base. I have also looked
through VB Tips, the MSDN CD's, and the FAQ for this newsgroup.
One thing to note - if I change the Printer.EndDoc to Printer.NewPage
in the code below, the printer is _not_ reset.
Type OrientStructure
Orientation As Long
Pad As String * 16
End Type
' Enter the following Declare statement on one, single line:
Declare Function Escape% Lib "GDI" (ByVal hDc%, ByVal nEsc%,
ByVal nLen%, lpData As OrientStructure, lpOut As Any)
Add the following code to the Command1_Click event procedure of the
Command1 button:
Sub Command1_Click ()
Const PORTRAIT = 1
Const LANDSCAPE = 2
Const GETSETPAPERORIENT = 30
Dim Orient As OrientStructure
'* Start the printer
Printer.Print ""
'* Specify the orientation
Orient.Orientation = LANDSCAPE
'* Send escape sequence to change orientation
x% = Escape(Printer.hDC, GETSETPAPERORIENT,
Len(Orient), Orient, NULL)
'* The EndDoc will now re-initialize the printer
Printer.EndDoc
Printer.Print "Should print in landscape mode"
Printer.EndDoc <--- This is what kills me.....
End Sub
Any help is appreciated. If you don't mind e-mailing a response
that would be great, but I am obviously not going to mind if
you just post to this newsgroup instead........Thanks!
--
Pat Wheaton
Mt. View, CA