Hello Dhivya,
Sorry for the delay and thank you for the description. In such case the only way that you can achieve your goal is to use stream in the Viewer.
For example you can try to use such logic:
1. In the Globals use such initialization code:
Viewer.SetRootStoragePath(Server.MapPath("~/App_Data"), Server.MapPath("~/App_Data/Cache"));
2. In the controller of the web page with Viewer (for example lets say it will be Index action):
public ActionResult Index()
{
const string testFilesDir = “~/testfiles/”;
string[] filePaths ={
@Server.MapPath(testFilesDir + “candy.pdf”),
};
StreamDefinition [] streamDefinitions = filePaths.Select(path => new StreamDefinition
{
Stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read),
FilenameExtension = Path.GetExtension(path)
}).ToArray();
return View(streamDefinitions);
}
3. In the view file:
@model StreamDefinition[]
@{
StreamDefinition[] streamDefinitions = Model;
}
@(Html.ViewerClientCode()
.TargetElementSelector("#test2")
.Streams(Model, “candy_timesheet”)
.OpenThumbnails()
.ZoomToFitWidth()
.BackgroundColor("#777")
.Locale(“es-ES”)
.ShowHeader(false)
.UseHtmlBasedEngine(false)
.UseInnerThumbnails()
)
@{
foreach (StreamDefinition streamDefinition in streamDefinitions)
{
streamDefinition.Stream.Dispose();
}
}
Please note that const string testFilesDir should be the path that you will use currently.
With such logic your App_Data folder will not contain any files that you view only the cache.
Also please find attached example code source.
Best regards.