[Vuejs]-How to load and preview pdf file in iframe through VUEX

0👍

By <iframe :src='getPDF'... you should provide the URL to the PDF in the scr, not the PDF content data.

I am not sure, if it is a good idea to store whole PDF in the Vuex store. You should better store the link to the PDF. Then it would be easy task.

But if you really want to do it this way, storing the PDF data in the Vues Store, then you will need to create an endpoint, which gives you your PDF file back.

I am not sure you can achieve this with Vue.js in frontend. It could be possibly done with Vue Router. But I would be slow and I suggest you to rethink the design of your dataflow.

Leave a comment