Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example of base64 pdf #136

Open
spormeon opened this issue Sep 7, 2022 · 1 comment
Open

example of base64 pdf #136

spormeon opened this issue Sep 7, 2022 · 1 comment

Comments

@spormeon
Copy link

spormeon commented Sep 7, 2022

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?

@benryanwilliams
Copy link

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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants