We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to Pass Headers With PDF Viewer

Thread ID:





146490 Aug 6,2019 07:26 AM UTC Mar 11,2020 09:51 AM UTC Angular - EJ 2 3
Tags: PDF Viewer
Ervin van der Merwe
Asked On August 6, 2019 07:26 AM UTC

Hi, we use token authentication for requests to our APIs. How can one pass headers from the Angular PDF Viewer control?


Akshaya Arivoli [Syncfusion]
Replied On August 6, 2019 12:27 PM UTC

Hi Ervin, 

Thank you for contacting Syncfusion support. 

We can add Authorization header to the PDF Viewer control’s Ajax request in the sample level.  Kindly include the below code in ngOnInit() of TS file, 

ngOnInit(): void {             
             (<any> XMLHttpRequest).prototype.realSend = XMLHttpRequest.prototype.send; 
        var newSend = function (vData)  {       
                this.setRequestHeader('Authorization', 'Bearer 64565dfgfdsjweiuvbiuyhiueygf');           
        XMLHttpRequest.prototype.send = newSend; 

The XMLHttpRequest’s method setRequestHeader(), adds custom HTTP headers to the request.  

We have created the sample for the same and shared in the following location, 

Please find the below KB link for reference, 

Please try this and let us know if you have any concerns on this. 


Ervin van der Merwe
Replied On March 11, 2020 06:55 AM UTC

Thanks this worked well.

Akshaya Arivoli [Syncfusion]
Replied On March 11, 2020 09:51 AM UTC

Hi Ervin, 

Thank you for your update. Please feel free to contact us if you have any other concerns. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon