How do I specify a password for a document using PrizmDoc?

Modified on Thu, Aug 14 at 8:32 AM

Can PrizmDoc handle password-protected files, such as PDFs or Excel files? How would a user specify a password for a particular document?


It is possible to specify the password for a password-protected document when creating a viewing session in PrizmDoc. When sending a request to create a viewing session, you'll use the password field in the request body to specify the password. For example...


POST http://localhost:3000/ViewingSession
Content-Type: application/json
{
    "source": {
        "type": "url",
        "url": "https://www.usability.gov/sites/default/files/creating-wireframes.pdf"
    },
    "password": "hunter2"
}

(In the case above "hunter2" is the password for the document)


Please note that even if a file needs a password and is not provided one (or the password provided is incorrect), the viewing session should still be created successfully. The easiest method to determine whether the password is needed/correct is to make a call to get the page. You can do this by making a GET request to the GetPage route using the viewingSessionId created earlier, like so...


GET pas_base_url/Page/q/0?DocumentID=u{viewingSessionId}


...be sure to replace pas_base_url with the root of your Prizm Application Services (PAS) instance and replace {viewingSessionId} with the actual value for viewingSessionId created in the previous step.


The above call will return 200 OK if the page load is successful. If a password is required/incorrect, you should see a return status code 480. There will be additional response headers called accusoft-status-number and accusoft-status-message, which should be 4001 and "Document requires a password", respectively.


You can use this information to re-create a viewing session with the correct password, or you can use the Replacement API to update the viewing session params with the password.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article