- Create the client part of the print job description.
TGenericClientJobDescription* clientPart = new TGenericClientJobDescription;
- Set the number of copies.
clientPart->SetCopies(numberOfCopies); // number of copies
- Specify a page range.
clientPart->SetPageRange(TStandardPageRange(2,5)); // pages 2 through 5
- Add the client job component to a printer job component created by a printer.
Usually the system passes you a printer when you make a request or when the end user specifies a print operation by dragging a document onto a printer. You can also resurrect one you've kept with the folio or flattened in some data dictionary somewhere; you cannot create one from scratch.
Currently, you must construct the printer before you can use it. Future releases of the system will provide TPrinter objects. To instantiate a
printer, use:
TPrinterprinter(kSystemPrinter); // This is temporary only
This creates a printer object representative of the system default printer. To get a job description, just ask the printer to create one for you.
// combine both client and printer job descriptions
TPrintJobDescription
jobDescription(printer.CreateJobDescription(),clientPart);
The TPrintJobDescription object adopts both job description components so the client has no more dealings with either of them.
- Use the print job to print a job.
myPageFolio.Print(jobDescription);