PDA

View Full Version : Printing Duplex



jem-designer
06-17-2004, 03:40 PM
I'm driving form letters by Automation through Word 2002. I want some letters to activate my Ricoh printer's duplex (two-sided) printing. MSKB 230743 (http://support.microsoft.com/default.aspx?scid=kb;[LN];230743) shows a bunch of really ugly code needed to do it. Has anyone packaged that, or have a better way?

jamescol
06-17-2004, 05:52 PM
I do not have a duplex print with which to test, but try using:



With Dialogs(wdDialogFilePrint)
.duplexprint = True
End With

jem-designer
06-18-2004, 09:51 AM
Thanks, I wish it were that easy, but no. First, it's a 3-valued parameter, not T/F: False; or for duplexing the printer can flip paper on the long edge OR on the short edge.

Knowledgebase article 230743 says...
Microsoft Word for Windows does not provide a method for Automation clients to set the duplex print flag before starting a print job. Although there is a parameter in the PrintOut method that indicates support for duplex printing, the parameter does not provide true duplex printing and may not be available depending on your operating system or installed language. However, developers can work around this limitation on Windows systems by changing the duplex flag for the active printer driver before calling Word's PrintOut function.
...That's what I didn't want to have to do.

jamescol
06-18-2004, 12:26 PM
You know, another option might work, depending on how many folks need to use your code.

You could install a second instance of the printer on the PC and set its default properties for duplexing. Then just call that printer in your code.

Otherwise, it looks like using the Windows API is the only way to make it work.

Old Doug
04-20-2005, 08:28 PM
Hi Folks, I am trying to solve a similar problem and have set up multiple printer "installations" or "instances" so that I can change the tray in a WORD macro. Some of my document also requires duplex printing and I am able to do that too using this technique. HOWEVER, the trouble that I am having is that, intermittently part of the job (for example the pages that are duplex printed) gets done out of sequence!

In my print commands I have turned background printing FALSE (which helped some) but I am thinking there is a different print que for each of these printer "installations". I have tried delaying the print commands (poor results) and I have tried varying the size of the jobs (the idea being that if they are similar in "size" then all things being equal they will be printed in the order they were sent). This is working fairly well, but I sure would like to have a better handle on it. I am thinking that there must be some settings that would affect this but I am not sure.

(My printer is an LaserJet2430dtn 2 real trays and 1 specailty tray - I have a memory upgrade in the mail - and I am using Word 2000 on Windows XP Home)

Any comments are welcome.

MOS MASTER
04-24-2005, 06:57 AM
Hi, :D

Don't know if I fully understand you're question.

Could you post you're code for us so we can see how you're printing.

For the sequence part:
* In the PrintOut Method dit you set Collate:=True

Enjoy! :thumb

Old Doug
04-24-2005, 07:37 PM
For pagenum = 0 To 19
Select Case pagenum
Case 0 ' page 20 is a separator page legal size in tray 1
ActivePrinter = "HP2430 tr1 ss"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="20", PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=False, PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

Case 1 To 3 ' regular single sided from tray 3
ActivePrinter = "HP2430 tr3 ss"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:=Str(pagenum), PageType:= _
wdPrintAllPages, Collate:=True, Background:=False, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

Case 4 ' (prints 4 & 5) two duplex printed pages from tray 2 (NCR paper)
ActivePrinter = "HP2430 tr2 dup"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, _
Pages:=Str(pagenum) + "," + Str(pagenum + 1) + "," + Str(pagenum) + "," + Str(pagenum + 1), _
PageType:=wdPrintAllPages, Collate:=True, Background:=False, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

Case 6 To 13 ' need 2 copies of these pages from tray 2 (NCR paper)
ActivePrinter = "HP2430 tr2 ss"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:=Str(pagenum) + "," + Str(pagenum), _
PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=False, PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

Case 14 To 18 ' regular single sided from tray 3
ActivePrinter = "HP2430 tr3 ss"
Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
wdPrintDocumentContent, Copies:=1, Pages:=Str(pagenum), PageType:= _
wdPrintAllPages, Collate:=True, Background:=False, PrintToFile:=False, _
PrintZoomColumn:=0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, _
PrintZoomPaperHeight:=0

End Select
Next pagenum


You can see that I have many instances of the same printer which allows me to select trays and duplex. If I go through this code a second time to soon, then I start to get things out of sequence, for example the legal size seperator sheets might come both together at the end, or any other possible shuffle. What happens (I think) is that each of these 3 instances has its own queue and each of my "printout" calls to print is in effect a separate job.

What I have done is set "print direct to printer" on the defaults of each "instance" to avoid a queue, which works but I start getting errors before getting 2 copies out (which I assume is because the printer memory is full - I have upgrade to max in the mail).

My ultimate goal is to print 3 or 4 copies of my document at a time - enough to fill the output tray. Any advice on achieving that end will be appreciated.

Doug

PS - By the way I always have copies=1 because when I set the "printing preferences" I have somehow forced an override of copies=1 anyway - but that is another story and something that I am sure I can rectify by creating a fresh install.

PPS - I have printed test documents "to file" and taken a look at the PJL and PCL (limited grasp of it all) with the hope that I can get the settings I want but send all the files to the same printer instance and thus to the same queue. Just begun this line of experiment!)

MOS MASTER
04-26-2005, 10:57 AM
Hi, :D

A lot to read....

The print count at most printers is by default 1 (If you want the default raised you can do that in the printer settings (Copy Count))

You're printing directly to the printer. I always use just Background:=False (Printout command) and I've never had problems with the queue getting blocked..

Have you tried the option "Start Printing after last page is spooled" of you're printer? (Mine by the way is always on: "Spool print documents so program finishes printing faster" / "Start printing immediatly")

You've made several instances of a printer but have you tried to print manually (Copies 4 or something) to see if the same thing happens with the duplex printing getting out of sequence....? (Make shure you're manual print job is ok before you try to automate it)

Let's first look at this before automating this process...:rofl:

Enjoy!

Old Doug
04-30-2005, 04:45 PM
Thanks for your interest in my problem. I think that I have it more or less solved. Ultimately it boils down to wanting to have part of the Word doc printed single sided and part double sided. I have solved it by changing from a pcl6 to a pcl5 driver (more editable output) and then printing to a file.

Most sections of the document I indicate which paper tray to use but the sections that I want duplexed I choose "auto select". Then I can go into the ".prn" file, change the "&l7H" to "&l1H" (tray 2) and also change the associated "&l0S" to "&l1S" (duplex w. long edge binding). Then I send the file on its way in a DOS window. It works well.

By choosing the option to have the job held in the printer, I can print out multiple copies, or I can send the .prn file again. I have not automated the process yet but will.

To do that I will record a macro of me creating the .prn file and then add to it code to open the file and make the necessary changes, and then send it on to the printer.

I think I have this particular probelm beat! Thanks again.

MOS MASTER
05-01-2005, 11:06 AM
Hi, :D

You're welcome..and I'm always interested!

Seams to me you're going to make this work.

Automating it by hand is always the first step in the automation proces. The process of automating printers is always printer specific and there is no generic code to make this work. (That's why a lot of people install more than one printer with specific settings in the properties of that printer)

Good luck in automating this process! :thumb