/*
######################################
Most of this code is just inline imports due to jsfiddle limitations, the code
you would actually use is in the HTML and in the new Vue block all the way at
the bottom. No custom CSS is used for this demo, all the css used here are just
imports that would be included automatically by vue. For more information
please see https://github.com/FranckFreiburger/vue-pdf/blob/master/README.md
HOW TO UPDATE THIS DEMO:
1. inline the resizeSensor script
2. change export default to `const resizeSensor = {`
3. inline the pdf.vue script
4. remove import and PDFJS lines form the pdf.js headers
5. Find the export default line and change it to `const pdf =`
6. inline the syles for resize-sensor.vue and pdf.vue
######################################
*/
// ############################# resizesensor.js #############################
const resizeSensor = {
// thanks to https://github.com/marcj/css-element-queries
props: {
initial: {
type: Boolean,
default: false,
}
},
data: function() {
return {
size: {
width: -1,
height: -1
}
}
},
methods: {
reset: function() {
var expand = this.$el.firstChild;
var shrink = this.$el.lastChild;
expand.scrollLeft = 100000;
expand.scrollTop = 100000;
shrink.scrollLeft = 100000;
shrink.scrollTop = 100000;
},
update: function() {
this.size.width = this.$el.offsetWidth;
this.size.height = this.$el.offsetHeight;
}
},
watch: {
size: {
deep: true,
handler: function(size) {
this.reset();
this.$emit('resize', { width: this.size.width, height: this.size.height });
}
}
},
render: function(create) {
var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;';
var styleChild = 'position: absolute; left: 0; top: 0;';
return create('div', {
style: style + 'animation-name: resizeSensorVisibility;',
on: {
'~animationstart':...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.