Solved

Splitting print job between multiple printers.

Posted on 2001-06-21
8
560 Views
Last Modified: 2010-05-02
Within my VB app, I need the ability to split large print jobs between multiple printers to print simultaneously.

Any suggestions?
0
Comment
Question by:gcraig
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:abaldwin
ID: 6216273
Just watching.  very verY veRY vERY VERY good question.

Andy
0
 
LVL 10

Expert Comment

by:arana
ID: 6216384
you can setup an array of print jobs (or pages in a print job depending on what your app does)

lets say 3 printers and 10 print jobs

array printjobs (10)
array printers (3) 'each element with printer name
then cycle that array

p=0

for n=0 to ubound(printjobs())
print printjob(n) on printer p 'i invented this syntax :)
                                ' because you are not
                                'telling us how you are
                                'printing
p=p+1
if p=ubound(printers()) then p=0
next

clear your array and asign new print jobs to the begining

... or something like that, never done that and this is just a comment, but it should give you an idea.

just need to asign each new print job to a new array element.
0
 
LVL 4

Expert Comment

by:abaldwin
ID: 6216390
I think he is wanting to take say a 5000 page report and print 1-1000 on printer 1 1001-2000 on printer 2 and 2001- 5000 on printer 3.

If anybody has a fairly easy way of doing this in access I would be willing to post points for it as well.  

Andy
0
 
LVL 17

Expert Comment

by:inthedark
ID: 6216406
Here are two simple ways:

1) The simple answer is to open the data required in known order and start printing from different starting points. Create a batch file with multiple lines starting your report.exe with a command line.

e.g.

Report.EXE A, GZZZZZZ, PrinterName1
Report.EXE H, PZZZZZZ, PrinterName2
Report.EXE Q, TZZZZZZ, PrinterName3
etc.

or for numeric keys:

Report.EXE 0, 15000, PrinterName1
Report.EXE 15001, 30000, PrinterName2

If the data does not have a unique primary key or numeric identity then you may have to loop through the data inthe required order and create a sequential identity.

Before the job starts running find the requested printer:

dim pr as printer
set pr=nothing
for each pr in printers
    if pr.devicename=requestedprinter then
        set printer=pr
        exit for
    end if
Next

' handle invalid printer name
if pr is nothing then
    msgbox "Invalid printer"
    end
end if

2) Method 2 - In your page headings add 1 to a currentbatchpage counter.  When the currentbatchpage>100 then swap to the next printer:

e.g.
Const PagesInBatch=100

currentbatchpage=currentbatchpage+1

If currentbatchpage>PagesInBatch then
    printer.enddoc
    SetUpNextPrinter ' a sub to Set Printer=Next printer device.
end if

Ths method won't work on windows 95 or 98 clients as they are only allow a maximum of 100 pending print jobs.  So in this case you must set PagesInBatch=TotalPagesRequired/90.





0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 17

Expert Comment

by:inthedark
ID: 6216424
Furthermore, when pinting more than 2000 print jobs in any day you may start getting GPF's in SPOOL32.DLL.  If this is the case configure the printer drivers to start printing after the last page has printed and using RAW spool format and not EMF.

0
 
LVL 10

Expert Comment

by:arana
ID: 6216507
exactly you send your print request with parameters, if you can know the aproximate total page count you can divide your printing (more or less what i posted before but instead of using an array of print jobs, you can use each elemnt of the array as parameters to pass (range of pages))
0
 

Author Comment

by:gcraig
ID: 6218067
Seems like I wasn't clear enough in my description, but abaldwin got the idea. It's a flat file of data which may contain between 15,000 and 50,000 pages. I don't have any code yet, still in the analysis and design stage.

I will be trying both suggestions (arana and inthedark). I don't know what effect switching printers within the code will have on the print queue of each printer.

Thanks for the suggestions, any further suggestions is still appreciated.
0
 
LVL 17

Accepted Solution

by:
inthedark earned 100 total points
ID: 6219525
Switching printers within the same print jobs works well.  You get one queue entry generated each time you switch.

But for large print jobs it is essential that each document has a unique key or numeric record on it so that if a batch gets screwed you can re-print from any given range of records.

If you are creating financial reports or audit lists which need to print totals you have to be able to allow re-print of any range of pages but still handle the totals.  But nowadays only mailing/letters are printed in large numbers as accounting records are normally printed to a CD.

If you haven't started this job yet I suggest that you create a spec for printing all output to a file which can the be interpreted  instead of using direct print commands (like PDF for example).  In this manner you can reprint/print preview/export from your saved spool image as required. The other advantage of using this approach is that you can generated custom formats e.g. Microsoft Word documents which can be placed on a CDROM and sent to a printing specialist.

For example instead of:

Printer.NewPage

Use your own printer driver class:

Dim Pr as new yourPrinterClass

Pr.NewPage

etc.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now