vue-print-it
v0.1.1
Published
A powerful Vue 3 plugin for printing components and elements with automatic style injection and optional bridge support
Maintainers
Readme
Vue Print It
Vue 3 printing plugin for browser print windows, hidden iframe printing, print-specific CSS, asset readiness, and optional local bridge printing.
Install
npm install vue-print-itpnpm add vue-print-ityarn add vue-print-itQuick Start
import { createApp } from 'vue'
import { createVuePrintIt } from 'vue-print-it'
import App from './App.vue'
createApp(App)
.use(createVuePrintIt({
preserveStyles: true,
pageSize: 'A4',
orientation: 'portrait',
printCss: '@media print { .no-print { display: none; } }'
}))
.mount('#app')<template>
<section id="invoice">
<h1>Invoice</h1>
<p>This section will be printed.</p>
</section>
<button @click="$print('invoice')">Print</button>
</template>Composable
<script setup lang="ts">
import { usePrint } from 'vue-print-it'
const { print } = usePrint()
async function printInvoice() {
await print('invoice', {
pageSize: 'A4',
orientation: 'landscape',
scale: 0.95
})
}
</script>Documentation
The full documentation now lives in the VitePress site under docs/:
Run the docs locally:
npm run docs:devBuild the docs:
npm run docs:buildDevelopment
npm ci
npm run typecheck
npm test
npm run build
npm run release:check