Free Support Forum - groupdocs.com

Compilation Error


#1

Hey,

I followed this documentation to develop a simple document viewer

http://groupdocs.com/docs/display/viewernet/How+to+use+GroupDocs.Viewer+for+.NET+in+an+ASP.NET+MVC+Project

I followed exactly the same steps to develop the application, but then there is this compilation error, moreover i was interested in seeing ViewerClientCode() this function’s definition. But there is no definition of this function and error is also on this function.
Kindly find the attached snapshot.

Thanks


#2

Hello,


We are sorry to hear that you have such issue. looks like you doesn’t have add GroupDocs.Viewer.dll to the references or missed to add this code line:
@using Groupdocs.Web.UI

Please double check you have this using at first line in the view.

Best regards.


#3

Ok, now there is no error but its not reading any document, just a blank page.

In fact i totally followed your documentation.

#4

Hello again,


Pleas share with us what you have set here and where is the doc file which you want to view located?

Thank you.

#5

I stored files here

Viewer.SetRootStoragePath(Server.MapPath("~/testfiles/"));


#6

This is my view’s code


@using Groupdocs.Web.UI


@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath(“mass_media.doc”)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Width(500)
.Height(300))

#7

Hi ,


Thank you for clarification. First of all you should replace with
and make sure that the “mass_media.doc” is located in the Server.MapPath("~/testfiles")

Best regards.

#8

Tried again, gave a literal path to FilePath()

@using Groupdocs.Web.UI


@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath("~/testfiles/candy.pdf")
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Width(500)
.Height(300))
.


Still showing me nothing in the browser.

#9

Still nothing



@using Groupdocs.Web.UI

@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath(“candy.pdf”)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Width(500)
.Height(300))


candy.pdf is there in testfile folder.

#10

Hi


As I said please change your code


@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath(“mass_media.doc”)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Width(500)
.Height(300))

With this one:


@(Html.ViewerClientCode()
.TargetElementSelector("#test")
.FilePath(“mass_media.doc”)
.EnableRightClickMenu(true)
.ShowThumbnails(true)
.OpenThumbnails(true)
.ZoomToFitWidth()
.Width(500)
.Height(300))

As you can see in the documentation we use a div element , using iframe or any other HTML element is incorrect and will not work.

Best regards.

#11

Hello,


Please download our examples . After installation you will find MVC solution example , investigate it and compare it with your project.

Best regards.

#12

Ok, I downloaded the sample again, first thing is this that sample needs a major update. Major references are not added, see the attached snapshot.

The first thing i did after downloading the sample is project building, but i won’t built successfully.
References needed to be added.
Second thing is this that when i add following references
1: ASP.NET MVC 4
2: GroupDocs.Viewer
and build project, it builds successfully, but when i run it, it gives configuration error.

#13

Hi,


I’m sorry to hear that, please try this one

Best regards.