Skip to main content
Participant
March 14, 2023
Question

use embed API JS in Vue 3 - reload or 2nd time loading not working

  • March 14, 2023
  • 1 reply
  • 783 views

Hi team,

First, want to thanks @Raymond Camden  for his awesome blog - Using the Adobe PDF Embed API with Vue 3 (raymondcamden.com) , guide me successfully integrate embed API within vue 3 at 1st step.

 

while, after I'm struggling into step 2 ~ I noticed if use same viewer to load pdf again will throw an error

refer to my screenshot

Uncaught Error: Cannot read properties of undefined (reading 'readFile')

TypeError: Cannot read properties of undefined (reading 'readFile')
    at t.syncFile (tsWorker.js:7:2975102)
    at tsWorker.js:7:2973824
    at workerMain.js:147:690
    at Array.forEach (<anonymous>)
    at t.acceptRemovedModel (workerMain.js:147:663)
    at e._handleMessage (workerMain.js:106:579)
    at Object.handleMessage (workerMain.js:106:196)
    at e._handleMessage (workerMain.js:104:402)
    at e.handleMessage (workerMain.js:103:975)
    at e.onmessage (workerMain.js:106:275)
    at editor.main.js:146:526

 

code pen - https://codesandbox.io/embed/adobe-vue-embed-api-forked-jlbymz?fontsize=14&hidenavigation=1&theme=dark 

This topic has been closed for replies.

1 reply

Raymond Camden
Community Manager
Community Manager
March 15, 2023

I believe I responded via email too, or two people asked similar questions. 😉 I think what you are running into is a bug with the Embed object and reusing it to preview a file. I haven't file that bug yet, but the fix is to recreate the object whenever you preview a new file. I fixed this in my Vue 2 version here, https://codepen.io/cfjedimaster/pen/MWqVxxa?editors=1111. And something similar could be done in Vue 3 of course. 

Participant
March 15, 2023

yes, thanks Ray. after using new instance to render pdf view every time when pdf reaload. the issue is gone