The HTML5 PDF Notes Viewer is a PDF viewer that is developed using HTML5 and JavaScript. It allows you to add annotations to the document. It works in tandem with the PDF Automation Server to convert supported files (.pdf, .doc, .docx, .jpeg, .png, gif, .tiff) directly to SVG format and then serve the document to the viewer.
Below are instructions on how to get started using the web viewer. The HTML5 viewer can be added to the page with minimal coding by simply creating an iframe element on the page with the URL to the document.
The standard viewer is designed to run on any desktop browser. The standard viewer can be loaded by itself as a full page viewer or embedded directly within the page using an iframe. A sample of the viewer embedded in an iframe can be found in the installation directory under "/html/viewer".
<style>
body, html {
margin: 0;
padding: 15px;
height: 96%;
overflow: hidden;
}
/* Style the iframe: toolbar will resize automatically based on width but recommended 1,000px minumum */
iframe {
width: 100%;
height: 100%;
border: none;
}
/* Required to make the full screen button work */
.iframe-fullscreen {
position: absolute;
left:0px;
top:0px;
width: 100%;
height: 100%;
border: none;
z-index: 999;
}
</style>
<html>
<body>
<!-- Set the attributes & additional options for the iframe. ID must be set to "viewerFrame" -->
<iframe id="viewerFrame" src="http://localhost:8090/viewer/pdfnotes.html"></iframe>
</body>
</html>
<html>
<body>
<!-- Set the attributes & additional options for the iframe. ID must be set to "viewerFrame" -->
<iframe id="viewerFrame" src="http://host:port/viewer/pdfnotes.html" name="pdfviewer"></iframe>
<script>
setTimeout(function(){
var url = window.location.href;
window.frames.pdfviewer.postMessage(url, "*");
}, 500);
</script>
</body>
</html>
The mobile viewer is designed specifically to run on mobile devices with smaller screens. The mobile viewer has been optimized to make the best use of the entire area on smaller screens as well as touch enhanced navigation. You will need to either create a direct link to the mobile viewer ("mpdfnotes.html") or add code to automatically redirect the user to the mobile viewer page if a mobile device is detected.
NOTE: For best results the mobile viewer should NOT be loaded within an iframe and should instead be served directly to the user as it's own page. It's recommended that instead of using redirect code, you should provide a direct link to the mobile viewer is created for mobile users. This will prevent unnecessary page flashing and shorten loading times on mobile browsers.
Below are instructions on how to setup a page redirect for mobile devices using JavaScript.
<script type="text/javascript">
window.onload = function() {
var docUrl = "http://{host}:{port}/viewer/mpdfnotes.html?filePath=" + getFilePath();
if (navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/Touch/i)
|| navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/Silk/i)){
window.location.replace(docUrl);
} else {
window.onbeforeunload = function(e) {
var dialogText = e.returnValue;
return dialogText;
};
}
}
function getFilePath() {
var url = window.document.getElementById("viewerFrame").getAttribute("src");
var docPath = url.split("=");
return docPath[docPath.length - 1];
}
</script>
Qoppa Software's PDF Automation Server for Windows, Linux, Unix, and macOS
Automate PDF Document Workflows through RESTful Web Services & Folder Watching
Copyright © 2002-Present Qoppa Software. All rights reserved.