Comments (8)
Hello again!
I could finally manage it to work.
1) Component not registered. It seems there was an issue with the packages. Cannot tell which exactly. But it was just ignoring it. So I solved that issue by doing:
npm install
npm audit fix
On the other hand, and not directly related with this issue:
- I wanted the pdf download to start as soon as the URL loaded, so I put the generatePDF() function within the mounted() hook. This resulted in an error because the child components were not ready. So I had to implement the $nextTick() function.
So, if anyone wants to download a PDF on mounted, yo need to do something like this:
async fetch() {
this.activeMenu = this.$store.state.activeMenu
},
mounted() {
this.$nextTick(() => this.print())
},
methods: {
print() {
this.$refs.html2Pdf.generatePdf()
},
},
More doc on this:
Maybe it could help to put also this use case in the docs for newbies like me. hehe.
Issue solved :D
Thanks again for your support.
Regards,
from vue-html2pdf.
Hmm can I see your file in this directory: ~/plugins/vue-html2pdf.js
?
It should look like this:
// vue-html2pdf.js
import Vue from 'vue'
import VueHtml2pdf from 'vue-html2pdf'
Vue.use(VueHtml2pdf)
from vue-html2pdf.
Hi! Thanks for your reply,
Yes, this is what I have in my plugin file:
import Vue from 'vue'
import VueHtml2pdf from 'vue-html2pdf'
Vue.use(VueHtml2pdf)
Also tried with import * as VueHtml2pdf, but no results
from vue-html2pdf.
Weird, the error says that the vue-html2pdf component is not registered, but im not seeing anything wrong on your code.
I uploaded the nuxt project I test on try have a look on it: https://github.com/kempsteven/nuxt-tester/tree/main
from vue-html2pdf.
Thank you so much for the time you put into this. I'll give you feedback as soon as I can test it. Thanks again.
from vue-html2pdf.
Hi again!
An update on this. I did the following and even having copied directly your page and component, still, throws me the error of "have you registered the component"?.
- Copied exactly the same line in nuxt.config plugins.
- Installed Babel-core, since I noticed you had it in your package and I didn't
- I copied and pasted your pages/index and also your content-pdf component in my project to test it as is.
Still getting the same error. I am not really sure what it is.
But if it is working in your naked project, there must be something I've installed interfering with the app... I googled a lot but couldn't find anything that puts me in the right direction. I think I've tried all the combinations possible.
I am using Nuxt 2.14, but I don't think it's relevant for the case.
Thank you again for your time.
Kind regards,
Nadine
from vue-html2pdf.
Hello, I'm not exactly sure whats wrong, the main issue is that the component is not registering.
I tried replicating this in a couple of nuxt application types (SSR and JAMStack), still no success in replicating the issue.
You could try implementing this in a new nuxt application and compare the two projects and see what could have been the issue.
Good luck!
from vue-html2pdf.
Cool :D
from vue-html2pdf.
Related Issues (20)
- Generates content on the center of pdf
- Not working on vue3 HOT 1
- xmldom Improper Input Validation
- xmldom Improper Input Validation
- xmldom Prototype Pollution
- shvl Prototype Pollution
- jspdf Cross-site Scripting (XSS)
- jspdf Cross-site Scripting (XSS)
- jspdf Regular Expression Denial of Service (ReDoS)
- xmldom Improper Input Validation
- xmldom XML External Entity (XXE) Injection
- The text movedown HOT 3
- Using ref as pdf-content does not print layout html report HOT 1
- It's getting blank after 30 page of Print content. How to solve it? HOT 5
- Prevent table overflow data
- Prevent table data overflow
- Vue 3: deprecated packages on vue3-html2pdf
- The text takes background color
- Docs/ ReadMe needs more transparency HOT 2
- Unable to Assign a PDF Created Without Download to a Vue Variable
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-html2pdf.