You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.


TOC PREV NEXT INDEX

Embedding Gecko API


nsIWebBrowserPrint


This interface controls the printing of an embedded Gecko WebBrowser window/document. It is scriptable.

Methods
print

Prints the specified DOM window.

Syntax:

void nsIWebBrowserPrint::print(
	in nsIPrintSettings aThePrintSettings,
	in nsIWebProgressListener aWPListener)  

Parameters:

aThePrintSettings: Printer settings for the print job. If it is null the global PS will be used.
aWPListener: Updated during the print.

nsresult :

NS_OK if successful.
printPreview

Print Previews the specified DOM window.

Syntax:

void nsIWebBrowserPrint::printPreview(
	in nsIPrintSettings aThePrintSettings,
	in nsIDOMWindow aChildDOMWin,
	in nsIWebProgressListener aWPListener)  

Parameters:

aThePrintSettings: Printer settings for the print preview. If it is null the global PS will be used.
aChildDOMWin: DOM window of the child document to be previewed (FrameSet frames).
aWPListener: Updated during the print preview.

nsresult :

NS_OK if successful.
printPreviewNavigate

Navigates through the print preview of the specified DOM window.

Syntax:

void nsIWebBrowserPrint::printPreviewNavigate(
	in short aNavType, in long aPageNum)  

Parameters:

aNavType: Navigation enum. See CONSTANTs below for possible values.
aPageNum: Page number to navigate to when
aNavType is set to PrintPreviewGoToPageNum.

nsresult :

NS_OK if successful.
cancel

Cancels the current print.

Syntax:

void nsIWebBrowserPrint::cancel()  

Parameters:

None.

nsresult :

NS_OK if successful.
enumerateDocumentNames

Returns an array of the names (Title or URL) of all documents and sub-documents. If the attribute isFramesetDocument is FALSE, this will return a single item. If the attribute is set to TRUE, it may return any number of items.

Syntax:

void nsIWebBrowserPrint::enumerateDocumentNames(
	out PRUint32 aCount,
	[retval, array, size_is(aCount)] out wstring aResult) 

Parameters:

aCount:[out] The number of documents.
aPageNum:[out] The array of names.

nsresult :

NS_OK if successful.
exitPrintPreview

Exits print preview mode and returns browser window to galley mode.

Syntax:

void nsIWebBrowserPrint::exitPrintPreview()  

Parameters:

None.

nsresult :

NS_OK if successful.
Attributes and Constants
readonly attribute nsIPrintSettings nsIWebBrowserPrint::globalPrintSettings

Gets a "global" PrintSettings object . If one doesn't exist, it is created. This is the object that is returned each time after that. The settings are initialized from the default printer.

readonly attribute nsIPrintSettings nsIWebBrowserPrint::currentPrintSettings

Gets a pointer to the PrintSettings object that that was passed into either "print" or "print preview". This enables any consumers of the interface to have access to the "current" PrintSetting at later points in the execution.

readonly attribute nsIDOMWindow nsIWebBrowserPrint::currentChildDOMWindow

Gets a pointer to the current child DOMWindow that is being print previewed. (FrameSet Frames) Returns null if parent document is not a frameset or the entire FrameSet document is being print previewed. This enables any consumers of the interface to have access to the "current" child DOMWindow at later points in the execution.

readonly attribute boolean nsIWebBrowserPrint::doingPrint

TRUE if in Print mode, FALSE otherwise.

readonly attribute boolean nsIWebBrowserPrint::doingPrintPreview

TRUE if in PrintPreview mode, FALSE otherwise.

readonly attribute boolean nsIWebBrowserPrint::isFramesetDocument

TRUE if the current document is a frameset document, FALSE otherwise.

readonly attribute boolean nsIWebBrowserPrint::isFramesetFrameSelected

TRUE if the current document is a frameset document and is selected, FALSE otherwise.

readonly attribute boolean nsIWebBrowserPrint::isIFrameSelected

TRUE if an IFrame is selected, FALSE otherwise.

readonly attribute boolean nsIWebBrowserPrint::isRangeSelection

TRUE if a "range" is selected, FALSE otherwise.

readonly attribute long nsIWebBrowserPrint::printPreviewNumPages

Gets the total number of pages for the print preview.

const short nsIWebBrowserPrint::PRINTPREVIEW_GOTO_PAGENUM=0
const short nsIWebBrowserPrint::PRINTPREVIEW_PREV_PAGE=1
const short nsIWebBrowserPrint::PRINTPREVIEW_NEXT_PAGE=2
const short nsIWebBrowserPrint::PRINTPREVIEW_HOME=3
const short nsIWebBrowserPrint::PRINTPREVIEW_END=4

Values for printPreviewNavigate above.


Written by:Ellen Evans | Comments, questions, complaints? Bug 143387
TOC PREV NEXT INDEX