crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.32k stars 674 forks source link

Vue2: Unexpected argument type! Expected "string" or "object", got function #604

Open Sjoerd82 opened 3 years ago

Sjoerd82 commented 3 years ago

I've tried both importing as print and printJS, both ways won't work. I've seen a lot of similar issues on the forums here. Perhaps add instructions on how to add this package to a Vue setup.

Marek-Sokol commented 2 years ago

I am using this in Vue 2.6.12

npm i print-js --save

In component:

import printJs from 'print-js' ... printJs({ printable: this.pdf, type: 'pdf', base64: true })

peterkarn commented 1 year ago

How to make it print whole page? I am passing an id and type

print() {
            printJs({ printable: 'page', type: 'html' })
        }

but getting an error

TypeError: Cannot read properties of null (reading 'print') at performPrint (print.js?add5:903:1)