vue-html2canvas

Vue mixin for Html2Canvas
289,519 115
Install
npm install vue-html2canvas
Latest Version:0.0.4
License:MIT
Last Updated:Jul 11, 2023
Links: GitHub  ·  npm
Maintainer: cent1pede

vue-html2canvas

Vue mixin for Html2Canvas

Install

npm install vue-html2canvas

Or

yarn add vue-html2canvas

Usage

main.js

import Vue from 'vue';
import VueHtml2Canvas from 'vue-html2canvas';

Vue.use(VueHtml2Canvas);

component

<template>
  <div>
    <!-- SOURCE -->
    <div ref="printMe">
      <h1>Print me!</h1>
    </div>
    <!-- OUTPUT -->
    <img :src="https://raw.githubusercontent.com/mycure-inc/vue-html2canvas/HEAD/output">
  </div>
<template>

<script>
export default {
  data() {
    return {
      output: null
    }
  },
  methods: {
    print() {
      const el = this.$refs.printMe;
      // add option type to get the image version
      // if not provided the promise will return 
      // the canvas.
      const options = {
        type: 'dataURL'
      }
      this.output = await this.$html2canvas(el, options);
    }
  }
}
</script>

Made with ❤️ by Jofferson Ramirez Tiquez

Related Packages

vue3htmltocanvas

Vue mixin for Html2Canvas

26,730 0
vue-html-to-paper

Vue mixin for printing html elements to paper.

350,733 13
vue-image-editor

나의 첫 캔버스 이미지 편집기

2,915 5

Version History

Version Released License
0.0.4 MIT
0.0.3 MIT
0.0.2 MIT
0.0.1 MIT