Skip to content

Commit 283ee83

Browse files
authored
Merge pull request legalthings#16 from legalthings/webviewer-load-empty-src
Allow loading the webviewer with empty src
2 parents 7f42efc + 50acd4d commit 283ee83

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,22 @@ Include `viewer.html` using [SSI](http://httpd.apache.org/docs/2.4/howto/ssi.htm
3535
</div>
3636

3737
<script>
38-
PDFJS.webViewerLoad('some-document.pdf');
38+
// note that the file can also be a Uint8Array if you want to serve binary data
39+
var file = 'some-document.pdf';
40+
41+
// This initializes the webviewer, the file may be passed in to it to initialize the viewer with a pdf directly
42+
window.PDFJS.webViewerLoad();
43+
44+
// open a file in the viewer
45+
window.PDFViewerApplication.open(file);
3946
</script>
4047
</body>
4148
</html>
4249
```
4350

4451
## Upgrading the source
4552

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

4956
To update this version, get the patched pdf.js source code and build the project

pdf.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19443,8 +19443,7 @@ if (document.readyState === 'interactive' || document.readyState === 'complete')
1944319443
webViewerLoad();
1944419444
} else {
1944519445
PDFJS.webViewerLoad = function (src) {
19446-
if (src)
19447-
DEFAULT_URL = src;
19446+
DEFAULT_URL = src;
1944819447
webViewerLoad();
1944919448
};
1945019449
}

0 commit comments

Comments
 (0)