Why do I receive a 404 error when I create a viewing session using an absolute path to a local document?

Question

I am creating a viewing session from a local document on my server and providing an absolute path “C:\Users\Public\Documents\Accusoft\Common\Images\PdfDemoSample.pdf” as the fileName but I receive a 404 error. What could be the reason for this and how can I fix it?

Answer

For security reasons, PAS disallows providing absolute paths for documents that are outside of the directory specified in the documents.path in the pcc.win.yml config file. So trying to provide a path to any file outside of that directory will cause a 404 error.

We recommend that you set documents.path to the directory in which you store your documents. When you create a create a viewing session using a local document, you should set fileName to the relative path to the document from the documents directory.

You can also set fileName to the absolute path to the document if it is contained in the documents directory (specified in pcc.win.yml) if you prefer to use absolute paths.