• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Mar 14, 2023 Mar 14, 2023

Copy link to clipboard

Copied

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

error-pdf-view-2.png

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=da... 

TOPICS
PDF Embed API

Views

404

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Mar 15, 2023 Mar 15, 2023

Copy link to clipboard

Copied

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 15, 2023 Mar 15, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources