Overview
ThecreateVuePrintItBridge function creates a Vue plugin that enables direct printer communication through the print bridge service. It provides reactive state management for printers, automatic connection handling, and seamless integration with your Vue application.
Import
Type Signature
Parameters
Configuration options for the bridge plugin
Returns
Returns a Vue plugin object with aninstall method. The plugin provides:
$printBridge- Enhanced bridge client instance (global property)$printBridgeState- Reactive bridge state (global property)- Injection keys for composable access
Usage
Basic Setup
Custom Configuration
With Multiple Options
Plugin Features
Reactive State
The plugin maintains reactive state for:- Available printers list
- Default printer selection
- Connection status
- Last update timestamp
Auto-Connection
WhenautoConnect is enabled, the plugin automatically:
- Checks bridge availability on installation
- Fetches available printers
- Selects a default printer if
autoSelectDefaultis true
Default Printer Selection
The plugin follows this priority for default printer selection:- Uses
defaultPrinteroption if provided - Selects printer marked as default by the system
- Fallback to first available printer
Global Properties
After installation, the following are available in your components:$printBridge
Access the enhanced bridge client from any component:$printBridgeState
Access reactive bridge state:Bridge State Interface
Enhanced Bridge Client Methods
The plugin enhances the baseBridgeClient with additional methods:
updatePrinters()
Updates the list of available printers and connection status.setDefaultPrinter(printerName)
Sets the default printer by name.getDefaultPrinter()
Gets the current default printer name.getState()
Gets a copy of the current bridge state.See Also
- usePrintBridge - Composable for bridge access
- BridgeClient - Core bridge client class
- Bridge Setup Guide - Complete bridge setup guide