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
Pass HTTP headers along with URL #36
Comments
@shreenil I am afraid, I am not able to understand your issue. What is the url you are passing? The component does not make any http calls. You have to make the call to api and feed the resulting byte array into the component. Look at this example: https://ng2-pdfjs-viewer.azurewebsites.net/bytearray |
@codehippie1, If you look at this example https://ng2-pdfjs-viewer.azurewebsites.net/home, one can pass url of document in Though, there is a note saying we need to have documents in 'assets' folder, I've tried passing my web API URL(which is returning byte stream) in Unfortunately, my web API is accessible to only 'Authenticated' users. So, i need to pass 'access-token' in API request headers to access the API URL. Why i need to directly pass URL in It would be great if I have option(feature) to pass headers if the URL is mobile. |
I sort of understood the problem. Please post relevant code here, both server side and client side. I will try to get headers added if it is feasible. Please note, source url is an underlying PDFJS's feature. Altering it may need tweaking. |
@shreenil I did my research and this is not directly available. viewerjs internally uses http request to set urls. (E.g .src etc). You will only be able to change http headers if the url is requested over javascript(Like ajax). The work around is to use the byte array mechanism. You can set http headers using it. (Example here - https://ng2-pdfjs-viewer.azurewebsites.net/bytearray ) |
My API is requesting Authorization header to access the files. How do i pass headers while passing URL in
pdfSrc
?The text was updated successfully, but these errors were encountered: