Passing value from external function to document function
Hi,
I am using below function to open pdf using Embed PDF API by using Session and Authentication.
document.addEventListener("adobe_dc_view_sdk.ready", function () {
/* The PDF embed mode option here */
const viewerConfig = {
embedMode: "FULL_WINDOW",
defaultViewMode: "FIT_PAGE", //FIT_WIDTH
showLeftHandPanel: true,
showAnnotationTools: true,
showDownloadPDF: true,
showPrintPDF: true,
showPageControls: true,
showDisabledSaveButton: true,
downloadWithCredentials: true
};
/* Initialize the AdobeDC View object */
var adobeDCView = new AdobeDC.View({
/* Registered client id */
clientId: "yourCliendID",
/* The div id in which PDF should be rendered */
divId: "adobe-dc-view"
});
/* Invoke the file preview API on Adobe DC View object */
adobeDCView.previewFile({
/* Pass information on how to access the file */
content: {
/* Location of file where it is hosted */
location: {
url: localPDFUrl,
headers: [
{
key: 'ASP.NET_SessionId',
value: currSessionID
},
{
key: '.ASPXAUTH',
value: currAuthToken
},
/* Pass meta data of file */
metaData: {
/* file name */
fileName: pdfFileName
}
}, viewerConfig);
});
As you can see from the above code, I need to pass below variable values from outside function. How can I pass the values from external function to above document function?
- localPDFUrl
- currSessionID
- currAuthToken
- pdfFileName
Please suggest.
