PDFTron Web Viewer not displayed on ASP.NET Razor View on using @model. I receive a HTTP 404 - Not Found error. Without using @model, and in the Controller removing return View(doc); and using return View(); the PDFTron Web Viewer displays the XOD document but on using @model the XOD Viewer is not displayed.
Razor View is as follows. Removing the @model XODViewer.DataModel.Document and changing return View(doc); to return View(); makes it work. I need to bind the View to the model class to access the properties of my model on the View.
Does PDFTron not support displaying the Web Viewer control on MVC Razor View bound to a model?
@model XODViewer.DataModel.Document
@{
ViewBag.Title = "Document";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/lib/WebViewer.min.js"></script>
<style>
#viewer {
width: 1024px;
height: 600px;
}
</style>
<script>
$(function () {
var docName = 'GettingStarted.xod';
var viewerElement = document.getElementById('viewer');
var myWebViewer = new PDFTron.WebViewer({
path: 'lib',
type: 'html5',
documentType: "xod",
initialDoc: "lib/GettingStarted.xod",
config: '',
streaming: false,
enableAnnotations: false,
enableOfflineMode: false,
enableReadOnlyMode: true
}, viewerElement);
});
</script>
<h2>Document</h2>
<div id="viewer" style="overflow: auto;width:100%;">
</div>
It has started working now with a relative path with the View now bound to a model class.
@model XODViewerApp.Model.Document
@{
ViewBag.Title = "Document";
}
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/lib/WebViewer.min.js"></script>
<style>
#viewer {
width: 1024px;
height: 600px;
}
</style>
<script>
$(function () {
var viewerElement = document.getElementById('viewer');
var myWebViewer = new PDFTron.WebViewer({
path: 'lib',
type: 'html5',
documentType: "xod",
initialDoc: "lib/GettingStarted.xod",
config: '',
streaming: false,
enableAnnotations: false,
enableOfflineMode: false,
enableReadOnlyMode: true
}, viewerElement);
});
</script>
<h2>Document</h2>
<div id="viewer" style="overflow: auto;width:100%;">
</div>