Skip to content

Commit

Permalink
Allow loading the webviewer with empty src
Browse files Browse the repository at this point in the history
  • Loading branch information
moesjarraf committed Mar 31, 2017
1 parent 7f42efc commit 8f63d5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,23 @@ 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
within a page.
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
Original file line number Diff line number Diff line change
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 8f63d5d

Please sign in to comment.