Skip to content

Commit

Permalink
Merge pull request #16 from legalthings/webviewer-load-empty-src
Browse files Browse the repository at this point in the history
Allow loading the webviewer with empty src
  • Loading branch information
moesjarraf committed Mar 31, 2017
2 parents 7f42efc + 50acd4d commit 283ee83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 9 additions & 2 deletions README.md
Expand Up @@ -35,15 +35,22 @@ Include `viewer.html` using [SSI](http://httpd.apache.org/docs/2.4/howto/ssi.htm
</div>

<script>
PDFJS.webViewerLoad('some-document.pdf');
// note that the file can also be a Uint8Array if you want to serve binary data
var file = 'some-document.pdf';
// This initializes the webviewer, the file may be passed in to it to initialize the viewer with a pdf directly
window.PDFJS.webViewerLoad();
// open a file in the viewer
window.PDFViewerApplication.open(file);
</script>
</body>
</html>
```

## Upgrading the source

Normally mozilla's PDF js viewer, will only run as standalone. We forked the project and patched it, so you can include it
Normally mozilla's PDF js viewer, will only run as standalone. We forked the project and patched it, so you can include it
within a page.

To update this version, get the patched pdf.js source code and build the project
Expand Down
3 changes: 1 addition & 2 deletions pdf.js
Expand Up @@ -19443,8 +19443,7 @@ if (document.readyState === 'interactive' || document.readyState === 'complete')
webViewerLoad();
} else {
PDFJS.webViewerLoad = function (src) {
if (src)
DEFAULT_URL = src;
DEFAULT_URL = src;
webViewerLoad();
};
}
Expand Down

0 comments on commit 283ee83

Please sign in to comment.