Using GetPdfFile from a read only share

I am trying to use imageHandler.GetPdfFile on a file located at:

\serverName\testshare\test.pdf

If I have write access to that share, it creates a folder there named test_pdf\img during processing and successfully returns the PDF which I can successfully store in a different path.

If I don’t have write access to that share, I get a System.UnauthorizedAccessException. I assume that’s because it can’t create the test_pdf\img folder structure.

Is there a way to use imageHandler.GetPdfFile from a read only UNC path?

Hi Hendrix,


Thanks for using GroupDocs.Viewer for .NET.

If you are using a UNC path as storage folder in the configuration of GroupDocs.Viewer for .NET then you will have to get the write access to that shared location because the API uses storage folder to create default cache directory within. One of the possible ways to tackle your issue is to use a local folder as cache directory which will be located on the same machine on which the application is running. In this way, the API will read the source document from UNC path and will create necessary files/folders in the local folder (which is set as cache directory). You can set the cache folder path using the following code.

ViewerConfig config = new ViewerConfig();
//set the cache path to a folder located on local machine
config.CachePath = “d://cache//”;

Please try it and share your feedback with us.

Warm Regards

See attached screenshot.


imageHandler.ViewerConfig.CachePath is set to one path but the exception is complaining about creating a folder at the source path.

Hi Hendrix,


Thanks for providing the details.

We tested your scenario with GroupDocs.Viewer for .NET 16.12.0 but unable to reproduce the issue using local cache folder and a read only storage location. Please make sure that you have proper read permissions to the shared location. Furthermore, please make sure that you are using the latest version of the API (16.12.0). If possible, you can share the complete ViewerConfig settings with us. We shall be looking forward to your response.

Warm Regards

The complete viewerconfig settings are shown in the attached image.


Hi Hendrix,


Thanks for sharing the details.

Please find the attached sample console application that successfully renders a PDF document located in a shared folder (using UNC path) and keeps the cache files on local machine’s folder. Please check if you are able to face the same issue with this application. Furthermore, please make sure that you are using version 16.12.0 of GroupDocs.Viewer for .NET.

Hope it helps.

Warm Regards

Thank you, this helped to resolve the issue.


I was not defining viewerConfig.StoragePath to be the source file’s directory.

Also, for the fileName value passed to viewerHandler.GetPages(fileName) I was using the full path to the source file including its directory and filename rather than just the file’s name.

Making those same 2 changes above (comment out viewerConfig.StoragePath = storagePath and set fileName equal to the source document’s full path) to your sample code provided results in the same error.

Hi Hendrix,


Its good to know that your issue is resolved. In case of any other queries, please feel free to contact us again.

Have a nice weekend ahead.
Warm Regards