You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.
I needed to load a PDF from a REST API and this failed because the credentials were not sent in the request. I found out that this is possible by passing an argument object with '{ "withCredentials": true }' as the second parameter to PDFViewerApplication.open().
Unfortunately angular-pdfjs-viewer does not support this, so I forked your project and made a quick fix. Maybe you could evaluate if this is a valid approach and can be merged or if you prefer another solution.
The text was updated successfully, but these errors were encountered:
This is precisely the use case when you should use the data attribute, see readme . It should be used whenever the pdf is not publicly available and you need to pass config/headers in the request to get the pdf.
I'd recommend using the $http service to get your pdf, see usage on how to pass in withCredentials to the config.
Example below:
<pdfjs-viewerdata="$ctrl.data"></pdfjs-viewer>
$scope.data=null;// this is loaded async$http.get("http://example.com/my-secure.pdf",{responseType: 'arraybuffer',withCredentials: true,headers: {}}).then(function(response){$scope.data=newUint8Array(response.data);});
I did consider using the data attribute but as far as I could see there are other arguments you could pass as well. It's not limited to that specific use-case only.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I needed to load a PDF from a REST API and this failed because the credentials were not sent in the request. I found out that this is possible by passing an argument object with '{ "withCredentials": true }' as the second parameter to PDFViewerApplication.open().
Unfortunately angular-pdfjs-viewer does not support this, so I forked your project and made a quick fix. Maybe you could evaluate if this is a valid approach and can be merged or if you prefer another solution.
The text was updated successfully, but these errors were encountered: