Free Support Forum - groupdocs.com

Error in Legacy Front End Demo of GroupDocs.Viewer-for-.NET IN TIFF-PDF format


#1

Hi

When I passed TIF,pdf,docx format file as filename in avaScript function in Index page,It gives me Exception from Viewer Controller.

Here I am giving FileName from folder which is in ProjectSolution
like D:/File Viewer Demos/GroupDocs.Viewer-for-.NET-master/Showcases/Legacy Front End/Legacy_Front_End/Files/test.pdf

Here exception brakes the code but if I continue i can view file in chrome.

Can anyone suggest me how to solve issue?

Here I have attached snapshot of error for each format separately


#2

Hi alokat,


Thanks for posting your query.

We apologize for inconvenience but I could not reproduce your raised issue. From the exception message it seems that you have modified the path in the project to save resource files. If yes then please make sure that the directory to keep resource files physically exists. Also, please make sure that the file you are passing in javascript must be located in App_Data folder.

Please try the above tips and share your experience.

Warm Regards

#3

please make sure that the file you are passing in javascript must be located in App_Data folder.


No I have not changed path of saving resource.
Also want to confirm that Is it necessary files to be exist in App_Data?

I have still facing same issue mentioned in snapshot with files in App_Data.
I have downloaded code from github from following link

https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-.NET/tree/master/Examples


#4

Hi alokat,


The default storage directory is set to “App_Data” folder in Legacy Front End. If you are using the file name in javascript like filePath: ‘demo.docx’, then it means that demo.docx is located in App_Data folder in the project. Please check whether the file you are loading is located in the storage folder or not. Also, please share the javascript snippet with us.

Warm Regards


#5

Hi

As you mentioned I have added javascript function beloaw.As well as I have attached my App_Data snapshot

$(’#viewerHtmlDiv’).groupdocsViewer({
//filePath: ‘http://groupdocs.com/images/banner/carousel2/signature.png’,
//filePath: ‘demo.docx’,
//filePath: ‘D:/File Viewer Demos/GroupDocs.Viewer-for-.NET-master/Showcases/Legacy Front End/Legacy_Front_End/Files/Img1.tiff’,
filePath: ‘D:/File Viewer Demos/GroupDocs.Viewer-for-.NET-master/Showcases/Legacy Front End/Legacy_Front_End/App_Data/test.pdf’,
//filePath: ‘ProcessFileFromStreamExample_1.pdf’,
//filePath: ‘ProcessFileFromStreamExample_2.doc’,
zoomToFitWidth: true,
//zoomToFitHeight: true,
showFolderBrowser: true,
showHeader: true,
showPaging: true,
width: 650,
height: 900,
useHtmlBasedEngine: true,
showDownload: true,
downloadPdfFile: true,
showPrint: true,
usePdfPrinting: true,
enableStandardErrorHandling: false,
preloadPagesCount: 1,
viewerStyle: viewerSyle.ScrollView //Layout type
});

// EnableRightClickMenu = false
$(’#viewerHtmlDiv’)[0].oncontextmenu = function () { return false; };
});

$(function () {
$(’#viewerImageDiv’).groupdocsViewer({
//filePath: ‘demo.docx’,
filePath: ‘D:/File Viewer Demos/GroupDocs.Viewer-for-.NET-master/Showcases/Legacy Front End/Legacy_Front_End/App_Data/test.pdf’,
//filePath: ‘http://www2.ensc.sfu.ca/grad/theses/tips/Effective_presentation.ppt’,
//zoomToFitWidth: true,
zoomToFitHeight: true,
showFolderBrowser: true,
showHeader: true,
showPaging: true,
width: 650,
height: 900,
watermarkPosition: ‘Diagonal’,
watermarkText: ‘Watermark for image’,
useHtmlBasedEngine: false,
showDownload: true,
downloadPdfFile: false,
showPrint: true,
usePdfPrinting: false,
supportPageRotation: true,
showThumbnails: true,
openThumbnails: true,
supportPageReordering: true
});
});





#6

Hi alokat,


Thanks for providing the details.

Please do not use complete path of the file like ‘D:/File Viewer Demos/GroupDocs.Viewer-for-.NET-master/Showcases/Legacy Front End/Legacy_Front_Ed/App_Data/test.pdf’ . You need to pass just file name along with the extension like filePath: ‘test.pdf’. It will load test.pdf file which is located in App_Data folder. Please try this and share your experience.


Warm Regards

#7

Hii


Yes thats’ working.
One more question
Can I change the saving path fro App_Data to Other Location?

thanks for your support


#8

Hi alokat,


Its good to know that your issue is resolved.

Yes, you can change the default storage location of the files in ViewerController.cs file. Please find below code in ViewerController.cs file

// App_Data folder path
private readonly string _storagePath = AppDomain.CurrentDomain.GetData(“DataDirectory”).ToString();

private readonly string _tempPath = AppDomain.CurrentDomain.GetData(“DataDirectory”) + “\Temp”;

You can set _storagePath and _tempPath of your choice . Please try and share your experience.


Warm Regards

#9

Hii

thanks for support.I will check it ,if I will find any issue,I will let you know


#10

Hi alokat,


Your are always welcome.


Best Regards