Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 48980

VueJs/Capacitor/html2pdf

$
0
0

Hi all,
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 :

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).output(`${this.patient.patientId +'.pdf'}`, 'D')
      } else {
        console.log("isNative")
        /*
        const writeSecretFile = async () => {
            await Filesystem.writeFile({
              path: 'secrets/text.txt',
              data: "This is a test",
              directory: Directory.Documents,
              encoding: Encoding.UTF8,
            });
          };
        */
      }

Thank you for help :wink:

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 48980

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>