Password protected pdf file not prompting for password

WebViewer Version: latest
ISSUE: When a password protected file is opened in webviewer, password was not prompted to the user.

In the earlier version - 1.5.3, this issue was resolved with a workaround to not open the file using webviewer cache.
WebViewer(
{
webviewerServerURL: null,
},

This resolved the issue, and password was prompted to the user as shown below

But we recently upgraded to latest version of webviewer, now this workaround is not working. Password is not promoted to the user.

Is there anything else that we need to do to fix this issue?

Hello priya.krishna,

Thank you for reaching out,

Can you provide the file youre using to test and the password for the file?
Additionally, please provide the exact steps to reproduce this issue.

Best regards,
Tyler

Hi,

You can use any password protected file

TestExtComments - with proarc comment_protected.pdf (25.8 KB)

Password is not prompted when the document is loaded.
I am calling the documentload as shown below
documentViewer.loadDocument(fileUrl, {
filename: fileName,
cacheKey: ket,
customHeaders:
});

And also getting this error in console-“Uncaught (in promise) Document requires a password. If you wish to process this type of document please use the password option.”

Hello priya.krishna,

You need to pass in the password via:

documentViewer.loadDocument(fileUrl, {
filename: fileName,
cacheKey: ket,
customHeaders:
password: () => { return 'password' }
});

If you want to prompt the user to put in a password via UI, use:

instance.UI.loadDocument(fileUrl, {
filename: fileName,
cacheKey: ket,
customHeaders:
});

Best regards,
Tyler

Hi

I am doing the same
instance.UI.loadDocument(fileUrl, {
filename: fileName,
cacheKey: ket,
customHeaders:
});

But still no prompt is coming for password.

Anything to add in WebViewer instance. This is the how I am initializing the WebViewer .
WebViewer(
{
path: “/WebViewer/lib”,
webviewerServerURL: ,
licenseKey,
fullAPI: true,
disableLogs: true,
css: ,
},

Thanks.
Priya K

Hello priya.krishna

This is not valid JavaScript

{
path: “/WebViewer/lib”,
webviewerServerURL: ,
licenseKey,
fullAPI: true,
disableLogs: true,
css: , // this here specifically
},


Best regards,
Tyler

Hi,
I just gave a sample without original values. May be consider the below sample
WebViewer(
{
path: “/Scripts/WebViewer/lib”,
webviewerServerURL: http://localhost:8090/demo/,
licenseKey,
fullAPI: true,
disabledElements: [
“downloadButton”,
“printButton”,
“thumbnailControl”,
“documentControl”,
],
disableLogs: true,
css: “/scripts/Webviewer.css”,
},

Should I configure anything more for the password prompt?

Thanks,
Priya K

Hello priya.krishna,

Please see this guide: Wv-server-troubleshooting | Apryse Documentation

Best regards,
Tyler

Hi,
I found the issue.
I had to use instance.UI.loadDocument instead of documentViewer.loadDocument.
Now I can see the password modal when password protected file is opened as shown below:

But is there any way to avoid the incorrect password error when the password protected file is opened for the first time.

Thanks,
Priya K

Hello

This is a bug that our team has in our backlog to resolve. Thank you for your patience with this.

Best regards,
Tyler

Hi,

Thank you for that confirmation.

But there is one more issue which I would like to address. I tried to load the password protected files with webviewerServerURL while initializing webviewer.
WebViewer(
{
webviewerServerURL: ‘http://localhost:8090’),
},
)

For the first time, the password modal appears to enter the password, but on the second attempt, the file loads in the background before the password popup is displayed, as shown below:

The details page appearing in the background is an issue, as the content should be protected and not displayed without the correct password.
Looks like this issue is because of caching the document in webviewer server.

Is there a way to prevent the content from being displayed before entering the correct password?

Thanks,
Priya K