Skip to main content

@rtorcato/browser-common / print

print

Functions

printPage()

printPage(): void

Defined in: print/index.ts:10

Triggers the browser's print dialog.

Returns

void

Example

import { printPage } from '@rtorcato/browser-common/print'
printPage()

printElementById()

printElementById(elementId): void

Defined in: print/index.ts:27

Prints a specific HTML element by its ID. Opens a new window with the element's content and triggers print.

Parameters

elementId

string

The ID of the element to print.

Returns

void

Example

import { printElementById } from '@rtorcato/browser-common/print'
printElementById('receipt')

isPrintAvailable()

isPrintAvailable(): boolean

Defined in: print/index.ts:52

Checks if the browser's print function is available.

Returns

boolean

True if print is available, false otherwise.

Example

import { isPrintAvailable } from '@rtorcato/browser-common/print'
if (isPrintAvailable()) showPrintButton()