Tutorial: Window.print

Window.print

Prints the window's web page. When silent is set to true, the API will pick the system's default printer if deviceName is empty and the default settings for printing.

Use the CSS style page-break-before: always; to force print to a new page.

Example

const win = fin.Window.getCurrentSync();

win.print({ silent: false, deviceName: 'system-printer-name' }).then(() => {
    console.log('print call has been sent to the system');
});

If a window has embedded views, those views will not print by default. To print a window's contents including embedded views, use the content option.

Example

const win = fin.Window.getCurrentSync();

// Print embedded views
win.print({ content: 'views' });

// Print screenshot of current window
win.print({ content: 'screenshot' })