-
Notifications
You must be signed in to change notification settings - Fork 23
/
test-pdf.js
40 lines (29 loc) · 897 Bytes
/
test-pdf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
'use strict'
/* for development/hotloading */
//import * as flipbook from '../src'
import * as flipbook from '../dist/flipbook-viewer.js'
import * as book from './book-pdf.js'
/* understand/
* main entry point into our program
*/
function main() {
const opts = {
width: 800,
height: 600,
}
const app = document.getElementById('app')
const next = document.getElementById('next')
const prev = document.getElementById('prev')
const zoom = document.getElementById('zoom')
book.init('/fp.pdf', (err, book) => {
if(err) console.error(err)
else flipbook.init(book, app, opts, (err, viewer) => {
if(err) return console.error(err)
viewer.on('seen', n => console.log('page number: ' + n))
next.onclick = () => viewer.flip_forward();
prev.onclick = () => viewer.flip_back();
zoom.onclick = () => viewer.zoom();
})
})
}
main()