Overview
ThecreateVuePrintIt function creates a Vue 3 plugin that adds global printing functionality to your application. It registers a global method (default $print) that can be accessed from any component.
Type Signature
Parameters
Configuration options for the print plugin
Custom name for the global method
Window name for the print window
Window specifications as array of strings or object with dimensions
Array of custom CSS styles to apply globally. Can be CSS strings or URLs to stylesheets
Delay in milliseconds before printing starts
Whether to automatically close the print window after printing
Title for the print window (defaults to current document title)
Whether to preserve original page styles in the print output
Returns
Returns a Vue plugin object with aninstall method that can be used with app.use().
The plugin registers the following global methods:
$print(or custom name): Main print function$print.getBridgeStatus: Get bridge status (only if bridge plugin is installed)$print.getAvailablePrinters: Get available printers (only if bridge plugin is installed)$print.printDirect: Print directly to a printer (only if bridge plugin is installed)
Usage
Basic Setup
With Global Options
Custom Global Method Name
Using in Components (Options API)
Using in Components (Composition API)
For Composition API, it’s recommended to use the
usePrint composable instead of accessing the global property directly.With Bridge Plugin
When the bridge plugin is installed, additional methods are automatically added:See Also
- usePrint - Composable for Composition API
- PrintOptions - Print configuration options
- Bridge Plugin - Direct printer access