Hi Ana,
Thank you for contacting Syncfusion support.
We can include the Authorization token in the PDF Viewer AJAX request using the ajaxRequest headers properties available in AjaxRequestSettings and it will be included in every AJAX request send from PDF Viewer. Please refer to the below documentation and code snippet.
Code Snippet:
<ejs-pdfviewer ref="pdfViewer_instance" id="pdfviewer" :serviceUrl="serviceUrl" :documentPath="document" :created="created"></ejs-pdfviewer>
methods: {
created(args){
var viewer = document.getElementById('pdfviewer').ej2_instances[0];
viewer.ajaxRequestSettings.ajaxHeaders = [{ headerName:'Authorization',headerValue:'Bearer 64565dfgfdsjweiuvbiuyhiueygf'}];
}
},
|
And you can send the parameter to the specific web action method on the server-side using ajaxRequestInitiate API. Please refer to the below code snippet and documentation.
Code Snippet:
<ejs-pdfviewer ref="pdfViewer_instance" id="pdfviewer" :serviceUrl="serviceUrl" :documentPath="document" :ajaxRequestInitiate = ajaxInitiate></ejs-pdfviewer>
return {
serviceUrl: 'http://localhost:55767/pdfviewer',
ajaxInitiate: function (args) {
if (args.JsonData.action == "Load") {
args.JsonData["title"] = "PDF Viewer";
var pdfviewer = document.getElementById('pdfviewer').ej2_instances[0];
pdfviewer.setJsonData(args.JsonData);
}
},
|
Kindly try this and let us know if you have any concerns about this.
Regards,
Dhivya.