Struggling to make a sample project work with HTML to PDF, but encountering an error message stating:
Could not find a declaration file for module 'vue-html-to-paper'
Even though it resides in my node_modules
index.js
import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import VueHtmlToPaper from 'vue-html-to-paper';
Vue.use(VueHtmlToPaper);
Vue.use(VueRouter)
component
<template>
<div>
<div>
<h2>I am a H2 tag</h2>
</div>
<!-- SOURCE -->
<div id="printMe">
<h1>Print me!</h1>
<div>■ ■ ■ ■ ■ ■</div>
</div>
<!-- OUTPUT -->
<!-- https://printjs.crabbly.com/ -->
<button @click="print">Click to print!</button>
</div>
</template>
<script lang="ts">
import Vue from 'vue';
import VueHtmlToPaper from 'vue-html-to-paper';
export default class TestComponent extends Vue {
print () {
// Pass the element id here
this.$htmlToPaper('printMe');
}
}
</script>
https://i.sstatic.net/9UMNE.png
Reinstalled node_modules multiple times without success. Any insights on dealing with this issue related to the package?
package.json file
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"docx": "^5.4.1",
"vue": "^2.6.11",
"vue-html-to-paper": "^1.3.1", <---- here
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},