Overview
Vue Print It provides extensive configuration options at multiple levels:- Global Options: Set defaults when installing the plugin
- Local Options: Override per print operation
- Bridge Options: Configure the bridge plugin for direct printing
Global Configuration
Set global defaults when installing the plugin. These apply to all print operations unless overridden.Global Options Reference
Fromsrc/types.ts:38:
| Option | Type | Default | Description |
|---|---|---|---|
name | string | '_blank' | Window name for the print window |
specs | string[] | object | ['fullscreen=yes', ...] | Window specifications |
styles | string[] | [] | Array of custom CSS styles |
timeout | number | 1000 | Delay before printing (ms) |
autoClose | boolean | true | Auto-close print window |
windowTitle | string | document.title | Print window title |
preserveStyles | boolean | true | Preserve original page styles |
globalMethodName | string | '$print' | Custom name for global method |
Print Operation Configuration
Basic Print Options
Override global settings for individual print operations:Complete Print Options Reference
Fromsrc/types.ts:4:
| Option | Type | Default | Description |
|---|---|---|---|
name | string | '_blank' | Window name for the print window |
specs | string[] | object | See below | Window specifications |
styles | string[] | [] | Custom CSS styles |
timeout | number | 1000 | Delay before printing (ms) |
autoClose | boolean | true | Auto-close print window |
windowTitle | string | document.title | Print window title |
preserveStyles | boolean | true | Preserve page styles |
onBeforePrint | Function | undefined | Callback before printing |
onAfterPrint | Function | undefined | Callback after printing |
onPrintError | Function | undefined | Callback on error |
useBridge | boolean | false | Use bridge for direct printing |
printerName | string | undefined | Printer name for bridge |
copies | number | 1 | Number of copies |
contentType | 'html' | 'pdf' | 'html' | Content type for bridge |
Window Configuration
Window Name
Specifies the window target:Window Specifications (Array)
Use string array for detailed window control:Window Specifications (Object)
Use object for simple width/height control:src/composables/usePrint.ts:233.
Style Configuration
Preserve Page Styles
Include all original page styles in print window:Custom Inline Styles
Add custom CSS rules:External Stylesheets
Include external CSS files:Mixed Styles
Combine inline and external styles:Timing Configuration
Print Delay (timeout)
Control when printing starts after window opens:src/composables/usePrint.ts:276).
Auto-Close Window
Control whether print window closes automatically:Lifecycle Callbacks
Before Print
Execute code before printing starts:After Print
Execute code after printing completes:Error Handling
Handle print errors:Complete Lifecycle Example
Bridge Configuration
Bridge Plugin Options
Configure the bridge plugin at installation:Bridge Options Reference
Fromsrc/types.ts:58:
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | 'http://localhost:8765' | Bridge service URL |
port | number | 8765 | Bridge service port |
autoConnect | boolean | false | Auto-connect on install |
autoSelectDefault | boolean | true | Auto-select default printer |
timeout | number | 2000 | Connection timeout (ms) |
retryAttempts | number | 3 | Retry attempts for failed connections |
defaultPrinter | string | undefined | Default printer name |
headers | Record<string, string> | {} | Custom HTTP headers |
debug | boolean | false | Enable debug logging |
Bridge URL Configuration
Bridge Connection Settings
Bridge Authentication
Add custom headers for authentication:Bridge Printer Configuration
Bridge Print Options
Using Bridge for Print Operations
Bridge Print Configuration
| Option | Type | Default | Description |
|---|---|---|---|
useBridge | boolean | false | Enable bridge printing |
printerName | string | Auto-selected | Target printer name |
copies | number | 1 | Number of copies |
contentType | 'html' | 'pdf' | 'html' | Content type |
Printer Selection Logic
Fromsrc/composables/usePrint.ts:187:
- Uses
printerNameif specified in options - Falls back to default printer from bridge state
- Refreshes printer list if no default found
- Uses first available printer if all else fails
Direct Print Method
Skip DOM and print raw HTML:Configuration Priority
Options are merged with the following priority (highest to lowest):- Local options (passed to individual print call)
- Global options (set during plugin installation)
- Default options (built-in defaults)
src/composables/usePrint.ts:323.
Advanced Configuration Examples
Complete Global Setup
Invoice Printing Configuration
Label Printing Configuration
Next Steps
TypeScript Support
Learn about TypeScript types and interfaces
Bridge Setup
Set up the bridge plugin for direct printing