Last active
November 27, 2020 05:12
-
-
Save zerojame/0e3bab490026419d23c94fbb80ed6d8c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div id="app"></div> | |
</template> | |
<script> | |
import pdfMake from 'pdfmake' | |
export default { | |
name: 'App', | |
mounted() { | |
this.export() | |
}, | |
methods: { | |
export () { | |
const docDefinition = { | |
content: [ | |
'English', | |
'ไทย' | |
] | |
} | |
pdfMake.fonts = { | |
// download default Roboto font from cdnjs.com | |
Roboto: { | |
normal: 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Regular.ttf', | |
bold: 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Medium.ttf', | |
italics: 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-Italic.ttf', | |
bolditalics: 'https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.66/fonts/Roboto/Roboto-MediumItalic.ttf' | |
} | |
} | |
pdfMake.createPdf(docDefinition).open({}, window) | |
} | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment