I share the most important lessons learned while building a PDF Viewer in Vue.
Ross Kaffenberger@rosstaGetting Lazywith Vue and PDFs
View Slide
Ross Kaffenberger@rosstaBuilding aPDF Vue-er
#dadjokes
• ross kaffenberger @rossta
rossta.net/vue-pdfjs-demo
PDF.js fetching
PDF.js rendering
PDF.js in Vue
Problem: Large PDFs
•Lazy render: draw tocanvas when visible•“Infinite” scroll: fetchpages in batches
Iteration #1: Math!
Problem: Vue cannotwatch $el properties
Manual work
Next iteration:
IntersectionObserver!
Advantages
•no $el property tracking•less code, fewer bugs•easier to extend
Akryum/vue-observe-visibility
Lesson:Opt for Vue-friendliness
Lesson:Be curious and flexible
rossta/vue-pdfjs-demo
@rosstarossta.net/talks[email protected]