- Main Page
- Packages
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# smjg.libs.sdwf.print.Printout Class Reference

The smjg.libs.sdwf.print.Printout abstract class represents a document for printing. More...

List of all members.

## Public Member Functions
| this (string documentName)
| Constructs a new Printout.
void | print (PrintDC dc, ushort copies=1, bool collate=false, ushort fromPage=1, ushort toPage=ushort.max, bool selection=false, bool alternate=false)
| Prints the document.
Properties
char[] | name ()
| The name by which the document will be identified.
string | name (string n)
| The name by which the document will be identified.
## Protected Member Functions
Callback Methods
void | initDocument (PrintDCBase dc)
| Initalises printing of the document.
void | initCopy (PrintDCBase dc)
| Initalises printing of a copy of the document.
bool | initPage (PrintDCBase dc, ushort pageNo)
| Initialises printing of a page.
abstract void | printPage (PrintDCBase dc, ushort pageNo)
| Renders a page.
bool | skipPage (PrintDCBase dc, ushort pageNo)
| Handles skipping of a page.
## Protected Attributes
bool | printSelection
| Whether the selection is to be printed, as opposed to the whole document or a specified range of pages.

## Detailed Description

The smjg.libs.sdwf.print.Printout abstract class represents a document for printing.

This class can be used to automatically print a specified page range and number of copies.

The callback methods have a PrintDCBase as a parameter. With the exception of Printout.printPage, methods should not output to it, but may use it to get or set DC properties.

None of the callback methods in this class should call PrintDC.startDocument, PrintDC.nextPage, PrintDC.endDocument or any of the Windows API equivalents. These methods are called automatically where necessary.

The programmer would define a subclass of Printout to print a particular kind of document.

Since:
  0.5

## Constructor & Destructor Documentation

smjg.libs.sdwf.print.Printout.this | ( | string | documentName | ) |

Constructs a new Printout.

Parameters:

  | documentName | name by which the document will be identified. This name appears when viewing the printer's queue.

Status:
  done

## Member Function Documentation

void smjg.libs.sdwf.print.Printout.print | ( | PrintDC | dc,
|  | ushort | copies = `1`,
|  | bool | collate = `false`,
|  | ushort | fromPage = `1`,
|  | ushort | toPage = `ushort.max`,
|  | bool | selection = `false`,
|  | bool | alternate = `false` |
| ) |  |  |

Prints the document.

Parameters:

  | dc | device context of the printer to which to print.
  | copies | number of copies to print.
  | collate | whether to collate copies. If `true`, all pages of each copy will be printed together. If `false`, all copies of each page will be printed together.
  | fromPage | number of the first page to print.
  | toPage | number of the last page to print.
  | selection | whether to print the selection. If `true`, the `fromPage` and `toPage` parameters are ignored.
  | alternate | whether to print only alternate pages. The value of `fromPage` determines whether to print the odd-numbered or the even-numbered pages.

Status:
  done

char [] smjg.libs.sdwf.print.Printout.name | ( |  | ) |

The name by which the document will be identified.

This name appears when viewing the printer's queue.

string smjg.libs.sdwf.print.Printout.name | ( | string | n | ) |

The name by which the document will be identified.

This name appears when viewing the printer's queue.

void smjg.libs.sdwf.print.Printout.initDocument | ( | PrintDCBase | dc | ) | `[protected]`

Initalises printing of the document.

This method is called before starting to print. The Printout.print method calls this method only once, regardless of how many copies are to be printed.

If the same Printout subclass object is reused to print on multiple occasions, this method can be used to update the state to take into account changes to the data.

The default implementation does nothing.

Parameters:

  | dc | device context of the printer on which the document will be printed.

void smjg.libs.sdwf.print.Printout.initCopy | ( | PrintDCBase | dc | ) | `[protected]`

Initalises printing of a copy of the document.

This method is called after initDocument. The Printout.print method calls this method before every copy is printed if copies are collated; otherwise, it is called only once.

If the implementations of page-related methods rely on being called in sequential order, then this method can be used to reset the state ready to print a new copy.

The default implementation does nothing.

Parameters:

  | dc | device context of the printer on which the document will be printed.

bool smjg.libs.sdwf.print.Printout.initPage | ( | PrintDCBase | dc,
|  | ushort | pageNo |
| ) |  |  | `[protected]`

Initialises printing of a page.

This method is called immediately before a page is printed, if the page number is within the requested page range. If copies are not collated, then this method is called only once for each page to be printed.

This method is also used to determine whether the given page number is within the document's range. This is important if the exact number of pages is not known at the time of displaying the Print dialog, if the application ever calls Printout.print directly without specifying a page range, or if a selection is being printed.

The default implementation does nothing but returns `true`. As such, it can be left as it is if the number of pages is known in advance, no attempt can ever be made to print beyond this number, and the application does not support selection printing.

Parameters:

  | dc | device context of the printer on which the document is being printed.
  | pageNo | number of the page to check.

Return values:

  | true | if the document has a page of this number.
  | false | if `pageNo` is outside the document's range of pages.

Note:
  This method is not called for a page that is to be skipped. The `initPage` and `skipPage` methods should return the same value for the same page.

abstract void smjg.libs.sdwf.print.Printout.printPage | ( | PrintDCBase | dc,
|  | ushort | pageNo |
| ) |  |  | `[protected, pure virtual]`

Renders a page.

This method is called every time a page is printed. An application may rely on this method being called on the pages in sequential order for efficiency, but must consider that it may be called on the same page number two or more times in succession.

Parameters:

  | dc | device context of the printer on which the document is being printed.
  | pageNo | number of the page to print.

bool smjg.libs.sdwf.print.Printout.skipPage | ( | PrintDCBase | dc,
|  | ushort | pageNo |
| ) |  |  | `[protected]`

Handles skipping of a page.

This method is called for every page to be skipped because printing is to start from a page other than the first, or because only alternate pages are being printed. A subclass overrides this method to perform any calculations involving stuff that would have been printed on the skipped page that may be necessary to print subsequent pages correctly.

This method is also used to determine whether a skipped page number is within the document's range. This is important if the exact number of pages is not known at the time of displaying the Print dialog, in case the user specifies a page range that is completely beyond the end of the document.

The default implementation does nothing.

Parameters:

  | dc | device context of the printer on which the document is being printed.
  | pageNo | number of the page to print.

Return values:

  | true | if the document has a page of this number.
  | false | if `pageNo` is outside the document's range of pages.

## Member Data Documentation

bool smjg.libs.sdwf.print.Printout.printSelection`[protected]`

Whether the selection is to be printed, as opposed to the whole document or a specified range of pages.

The documentation for this class was generated from the following file:

- print.d