arkokoley/pdfvuer

example of base64 pdf

spormeon opened this issue · 1 comments

would you have any expample of using a base64 coded pdf, I'm getting a value back which is from a "token" which is "billingtaxform", this come in as base64, as we are tokenising the data for PII compliance. I can get a pdf to view using the src, such as this but cant for the life of me get the base64 decoding working?

You can pass the base64 string into the src parameter as follows:

<template>
  <pdf :src="fullString" :page="1">
    <template v-slot:loading>
      loading content here...
    </template>
  </pdf>
</template>

<script>
import pdf from 'pdfvuer'

export default {
  data() {
    return {
      pdfString: null
    }
  },
  computed: {
    fullString() {
      return "data:application/pdf;base64," + this.pdfString
    }
  },
  components: {
    pdf
  }
}
</script>