0

When I try to access the pdf file which is public using the angular-pdf-viewer I got the following error message on console.

Error: [$parse:syntax] Syntax Error: Token ':' is an unexpected token at column 5 of the expression [http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf] starting at [://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf].

here is my pdf directive for rendering the pdf file:

<pdf-viewer delegate-handle="my-pdf-container" url="http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf" scale="1" show-toolbar="true" ></pdf-viewer>

could anyone help on this issue?

2
  • Can you share the directive's code ? Commented Apr 27, 2015 at 7:39
  • @mirfan899 is this solved for you? Commented Jun 25, 2015 at 7:55

1 Answer 1

1

all the samples seems to be suggesting define url on scope and reference it. But you may try the following, which stringifys the url

<pdf-viewer delegate-handle="my-pdf-container" url="'http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf'" scale="1" show-toolbar="true" ></pdf-viewer> 
Sign up to request clarification or add additional context in comments.

3 Comments

Error gone but I've got more errors. OPTIONS http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf 403 (Forbidden) XMLHttpRequest cannot load http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. The response had HTTP status code 403. pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf:1 OPTIONS http://pucdocket.s3.amazonaws.com/VA/PUE-2010-00039/122913.pdf 403 (Forbidden)
here is my app config: app.config(['$httpProvider', function ($httpProvider) { delete $httpProvider.defaults.headers.common["X-Requested-With"]; $httpProvider.defaults.useXDomain = true; $httpProvider.defaults.withCredentials = false; $httpProvider.defaults.headers.common["Accept"] = "application/json"; $httpProvider.defaults.headers.common["Content-Type"] = "application/json"; } ]);
@mirfan899 I assume that the reason you see this error is CORS, since you are trying to retrieve a file outside your host, try using github.com/Rob--W/cors-anywhere or create your own proxy

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.