behavior:pager

This element handles functionality of <frame|pager> and <frame type=pager> elements.

The pager implements print preview and printing functionality.

The behavior can be applied to any block element.

Elements

These elements have behavior:frame applied by default:

Model

After loading document in it the <frame|pager> the element will have as number of child <pagebox>es as defined by cols and rows attributes:

<frame|pager cols=2>
   <pagebox/>
   <pagebox/>
</frame>

Each <pagebox/> renders its own instance of the template inside representing page to be printed.

Attributes

<frame> attributes that have special meaning:

State flags

Events

Methods

loadDocument
([templateUrl:string], documentUrl:string) - initiates loading of the document and template from given URLs;
loadHtml
(html:string | Bytes, documentUrl:string) - loads document from html string, documentUrl is an url to resolve relative urls (if any);
pagesTotal
() : integer, returns number of pages found;
pageNo
() : integer, returns first page number rendered in the view;
pageNo
(number: integer), navigates view to page number;
selectPrinter
() : opens system select printer dialog to select target printer, configures page size accordingly, may start pagination process.
selectDefaultPrinter
() : selects default printer as a print target, may start pagination process.
print
( [pageslist:array] ) - prints current document on target printer.

pageslist - optional, is an array of page numbers. If provided defines numbers and order of pages to be printed. Note: page numbering starts from 1.

setDocumentName
(name:string) - sets name of print spooler job - this name will appear in print spooler queue view in Windows. 
printers
() : array

The method returns array of printers registered in system. Each element of the array is an object:

{ 
  id: string,           // id of the printer to be used in setPrinter() method;
  name: string,         // human readable name; 
  location: string,     // printer location if available;
  isDefault: true/false // true if that printer is the default one;
} 

Value

N/A

Frame events handling in script

var pager = $(frame#pager);

pager.on("paginationstart", function() {...});
pager.on("paginationend", function(evt) { var npages = evt.reason; ...});