Download pdf in the mobile version of the application



  • Hello! When you click on the button, the pdf file should download to the phone. In chrome, he downloads without problems. How can I implement a file download in a mobile application?

     <q-btn class="button blue-btn" @click="getPDF">Download</q-btn>
    
    getPDF: function () {
          html2canvas(document.querySelector('#ticket'))
            .then((canvas) => {
              let doc = new JSPDF('l', 'mm', 'a4')
              doc.addImage(canvas.toDataURL(''), 'JPG', 0, 0, 300, 250)
              let fileName = ` ${moment(this.readings.date).format('DD MM YYYY')}.pdf`
              doc.save(fileName)
            })
            .then(async () => {
              let email = this.getEmail.email
              console.log('my em:', email)
              this.$store.dispatch('send-pdf/create', { query: { email: email } })
            })
            .catch((e) => {
              console.log('errrrror:', e)
            })
        },
    


  • I believe you should ask this on JSPDF help platform


Log in to reply