arkokoley / pdfvuer

A PDF viewer for Vue using Mozilla's PDF.js that supports both Vue2 and Vue3
https://arkokoley.github.io/pdfvuer
MIT License
918 stars 131 forks source link

How to dinamically change the pdf sources? #64

Closed juan-carvajal closed 4 years ago

juan-carvajal commented 4 years ago

Hi, I tried using the packageto swith several pdf that come from a remote url, I only want to load each pdf once, and only when the user request it, I also want to be able to swith between any loaded pdf or unloaded pdf. I tried storing the promises in vue data props, but the pdf component only renders once, then theloading tasks are performed, but after they are cached, the pdf is stuck in the last document that was loaded through the creatingLoadingTask. how do I force the reload with the latest source?

arkokoley commented 4 years ago

Use a :key in the pdfvuer component and change the key when you change the src. This will force the component to be re-rendered.

Refer to #18