title: VueJs/Capacitor/html2pdf
body: <p>I want export pdf on my hybrid’s app (android/web app)
  The export pdf on web app is ok, but not on android capacitor app.
  I read the doc, but many examples are with pdfmake, not html2pdf.js.
  Here my function for create a pdf in my component Vue.js :</p>
  <p>Error : /storage/emulated/0/Documents/FL_19-11-2021_10-06-50.pdf: open failed: EACCES (Permission denied)</p>
  <p>manisfest.xml :</p>
  <pre><code>    &lt;!-- Permissions --&gt;
  
      &lt;uses-permission android:name=&quot;android.permission.INTERNET&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot; /&gt;
      &lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
  </code></pre>
  <p>Vue.js :</p>
  <p>import { Capacitor } from '@capacitor/core'</p>
  <p>import { Filesystem, Directory, Encoding } from '@capacitor/filesystem'</p>
  <pre><code>async egs2pdf () {
        this.$store.dispatch('setLoading', true, { root: true })
        let egs2PdfComponent = document.getElementById('egs2PdfComponent')
        this.opt.filename = this.patient.patientId
  
        if (!Capacitor.isNativePlatform()) {
          html2pdf().set(this.opt).from(egs2PdfComponent).save().then(() =&gt; {
            this.$store.dispatch('setLoading', false, { root: true })
          })
        } else {
          html2pdf()
            .set(this.opt)
            .from(egs2PdfComponent)
            .outputPdf()
            .then( pdf =&gt; {
              Filesystem.requestPermissions()
                .then( permission =&gt; {
                  if (permission) {
                    this.writeCapacitorFile(pdf)
                      .then(() =&gt; {
                        this.$store.dispatch('setLoading', false, { root: true })
                        this.$toast.success(&quot;Enregistré dans vos documents !&quot;)
                      })
                      .catch(error  =&gt; {
                        console.log(error)
                        this.$toast.success(&quot;Vidda n'a pas la permission d'accéder à vos documents&quot;)
                      })
                  }
                })
            })
        }
      },
      async writeCapacitorFile(pdf) {
        await Filesystem.writeFile({
          path: `${this.patient.patientId + '.pdf'}`,
          data: pdf,
          directory: Directory.Documents ,
          encoding: Encoding.UTF8,
        })
        .then(() =&gt; {
          return true
        })
        .catch(error =&gt; {
          return error
        })
      },
  </code></pre>
  <p>Thank you for help ;-)</p>