Holds the color value for the page background color.
The border inset around each side of every page in the preview. This is set to 0 if autoOrigin is false.
Holds the color value for the page border.
Specifies is clipping should be used to avoid creating too many cell states in large diagrams. The bounding box of the cells in the original diagram is used if this is enabled.
Reference to the graph that should be previewed.
The margin at the bottom of the page (number).
The margin at the top of the page (number).
Holds the actual number of pages in the preview.
Holds the Rectangle that defines the page format.
Boolean that specifies if the page selector should be displayed.
Specifies if the background image should be printed.
Specifies if controls (such as folding icons) should be printed. Default is false.
Specifies if overlays should be printed.
Holds the scale of the print preview.
Assign any window here to redirect the rendering in open.
Holds the title of the preview window.
Reference to the preview window.
Holds the horizontal offset of the output.
Holds the vertical offset of the output.
Adds the given graph to the existing print preview.
Writes the closing tags for body and page after calling writePostfix.
Returns the link for the given cell state. This returns null.
Returns wnd.
Shows the print preview window. The window is created here if it does not exist.
Optional CSS string to be used in the head section.
Optional window that should be used for rendering. If this is specified then no HEAD tag, CSS and BODY tag will be written.
Creates a DIV that prints a single page of the given graph using the given scale and returns the DIV that represents the page.
Width of the page in pixels.
Height of the page in pixels.
Optional horizontal page offset in pixels (used internally).
Optional vertical page offset in pixels (used internally).
Callback that adds the HTML content to the inner div of a page. Takes the inner div as the argument.
Optional
pageNumber: numberInteger representing the page number.
Implements printing of a diagram across multiple pages.
The following opens a print preview for an existing graph:
Use getScaleForPageCount as follows in order to print the graph across a given number of pages:
Additional pages
To add additional pages before and after the output, getCoverPages and getAppendices can be used, respectively.
CSS
The CSS from the original page is not carried over to the print preview. To add CSS to the page, use the
css
argument in the open function or override writeHead to add the respective link tags as follows:Padding
To add a padding to the page in the preview (but not the print output), use the following code:
Headers
Apart from setting the title argument in the
PrintPreview
constructor you can override renderPage as follows to add a header to any page:The pageNumber argument contains the number of the current page, starting at
Page Format
For landscape printing, use PAGE_FORMAT_A4_LANDSCAPE as the pageFormat in getScaleForPageCount and PrintPreview. Keep in mind that one can not set the defaults for the print dialog of the operating system from JavaScript so the user must manually choose a page format that matches this setting.
You can try passing the following CSS directive to open to set the page format in the print dialog to landscape. However, this CSS directive seems to be ignored in most major browsers, including IE.