-
Notifications
You must be signed in to change notification settings - Fork 34
Initialize Reader
Aferdita Muriqi edited this page May 25, 2020
·
5 revisions
<head>
<!-- R2 Reader CSS -->
<link rel="stylesheet" href="reader.css" />
<script> var exports = {}; </script>
<script src="reader.js"></script>
</head>
<body>
<script>
D2Reader.load({
url: new URL("http.....")
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
</body>
<script>
var lastReadingPosition = '{"href":"/OEBPS/Text/cover.xhtml","locations":{"progression":0.2},"created":"2019-05-21T12:53:08.145Z","type":"application/xhtml+xml","title":"Cover"}';
D2Reader.load({
url: new URL("http....."),
lastReadingPosition: lastReadingPosition
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var bookmarks = '[{"href":"/OEBPS/Text/cover.xhtml","locations":{"progression":0.2},"created":"2019-05-21T12:53:08.145Z","type":"application/xhtml+xml","title":"Cover"}]';
var initialAnnotations = {"bookmarks":bookmarks};
D2Reader.load({
url: new URL("http....."),
initialAnnotations: initialAnnotations
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var bookmarks = '[{"href":"/OEBPS/Text/cover.xhtml","locations":{"progression":0.2},"created":"2019-05-21T12:53:08.145Z","type":"application/xhtml+xml","title":"Cover"}]';
var highlights = '[{"href":"/OEBPS/Text/cover.xhtml","locations":{"progression":0.2},"created":"2019-05-21T12:53:08.145Z","type":"application/xhtml+xml","title":"Cover"}]';
var initialAnnotations = {"bookmarks":bookmarks, "highlights": highlights};
D2Reader.load({
url: new URL("http....."),
initialAnnotations: initialAnnotations
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
var userSettings = {
// appearance: "readium-sepia-on", //readium-default-on, readium-night-on, readium-sepia-on
// fontFamily: "serif", //Original, serif, sans-serif
// textAlignment: "justify", //"auto", "justify", "start"
// columnCount: "auto", // "auto", "1", "2"
// verticalScroll: false,
// fontSize: 100.0,
// wordSpacing: 0.0,
// letterSpacing: 0.0,
// pageMargins: 2.0,
// lineHeight: 1.0
}
D2Reader.load({
url: new URL("http....."),
userSettings: userSettings
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
<script>
D2Reader.load({
url: new URL("http....."),
useLocalStorage: true // true = local storage, false = session storage (default)
}).then(instance => {
console.log("D2Reader loaded ", instance);
}).catch(error => {
console.error("error.message ", error.message);
});
</script>
- GitHub Package
- Initialize Reader
-
Injectables
- Readium CSS
- Footnotes
- Glossary
- Fonts
- Pagebreak
- Injectable Context Menu
-
Reader API
- User Settings API
- Navigator API
- Bookmark API
- Annotation API
- TTS API
- Search API
- Callback API
-
Modules
- Bookmarks
- Annotations
- Search
- TTS