get field value from drupal in javascript code

Created on 17 September 2019, over 5 years ago
Updated 22 March 2023, almost 2 years ago

Hello
I created pdf protected with password. They are uploaded to drupal and the password is saved in a field pdf_password in drupal.
I would like the pdf to open with pdf.js without having to ask for the password. For this i need to get the value of the field password pdf_password in the file pdf.js/web/viewer.js: instead of 123 to get the value of the field password pdf_password :

if (typeof file === 'string') {
this.setTitleUsingUrl(file);
parameters.url = file;
parameters.password = '123';
} else if (file && 'byteLength' in file) {
parameters.data = file;
parameters.password = '123';
} else if (file.url && file.originalUrl) {
this.setTitleUsingUrl(file.originalUrl);
parameters.url = file.url;
parameters.password = '123';
}

Thank you

💬 Support request
Status

Active

Version

1.9

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024