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

PDF Page Content not rendered #46

Open
dcolley opened this issue Jan 25, 2022 · 5 comments
Open

PDF Page Content not rendered #46

dcolley opened this issue Jan 25, 2022 · 5 comments

Comments

@dcolley
Copy link

dcolley commented Jan 25, 2022

Hi,

git clone https://github.com/rossta/vue-pdfjs-demo
cd vue-pdfjs-demo
npm install
npm run serve

I had to update my vue to get the demo to run:

diff --git a/package.json b/package.json
index b5ffd0b..9ffc256 100644
--- a/package.json
+++ b/package.json
@@ -13,7 +13,7 @@
     "intersection-observer": "^0.5.1",
     "lodash": "^4.17.11",
     "pdfjs-dist": "^2.0.943",
-    "vue": "^2.6.3"
+    "vue": "^2.6.14"
   },
   "devDependencies": {
     "@vue/cli-plugin-babel": "^3.4.0",

I can see the number of pages:
image

... but the page content is not displayed.

In console we see this error:

Warning: getOperatorList - ignoring errors during "RenderPageRequest: page 0" 
task: "DataCloneError: Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': 
function at() { [native code] } could not be cloned.".
@dcolley
Copy link
Author

dcolley commented Jan 25, 2022

Ref issue #47 for the package mismatch error.

@dcolley
Copy link
Author

dcolley commented Jan 25, 2022

I downloaded url: process.env.VUE_APP_PDF_URL,
as per .env file: https://cdn.filestackcontent.com/wcrjf9qPTCKXV3hMXDwK
and saved it locally.
then hardcoded the url:

url: "/rfc7540.pdf", //process.env.VUE_APP_PDF_URL,

... and I have the same problem. Perhaps there is an issue with the pdf document?

Another document seems to work fine:
image

@ScarletBlue
Copy link

@dcolley Hi.

I tried hardcoding another pdf file like you did, but am getting the following error:
image

I placed the pdf file in src and wrote as follows:
url: "/sample.pdf",

and I get the error mentioned above.

Do you have any ideas?

Thanks.

@dcolley
Copy link
Author

dcolley commented Feb 10, 2022

@ScarletBlue are you sure the PDF is served by your app? It looks like you're getting html.

The file should be located in <proj>/public/sample.pdf
image

What do you get from http://localhost:3000/sample.pdf

@ScarletBlue
Copy link

@dcolley the location was the issue. Thanks!

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