Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to use in nuxt ? #95

Open
morteza-mortezai opened this issue Oct 17, 2021 · 2 comments
Open

how to use in nuxt ? #95

morteza-mortezai opened this issue Oct 17, 2021 · 2 comments

Comments

@morteza-mortezai
Copy link

i'm trying to use vue-html-to-paper in nuxt
and as i use it just in a single page then i imported it locally
but i get this error every time .
"VueHtmlToPaper" is not a function

so how can i use it locally ?

@cvalues
Copy link

cvalues commented Oct 29, 2021

Hi,

load it as plugin:
Create a print.js in the plugins dir, add the following code:

`import Vue from 'vue';
import VueHtmlToPaper from 'vue-html-to-paper';

const options = {
name: '_blank',
specs: [
'fullscreen=yes',
'titlebar=yes',
'scrollbars=yes'
],
styles: [
'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
'https://unpkg.com/kidlat-css/css/kidlat.css'
],
timeout: 1000, // default timeout before the print window appears
autoClose: true, // if false, the window will not close after printing
windowTitle: window.document.title, // override the window title
}

Vue.use(VueHtmlToPaper, options);

// or, using the defaults with no stylesheet
Vue.use(VueHtmlToPaper);`

and load it as plugin in your nuxt.config.js

@renansantos-fpass
Copy link

How do i use it in Nuxt 3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants