@ceereals/vue-pdf
Installation
npm install @ceereals/vue-pdf
Usage
Web
<script setup>
import { Document, Page, Text, View, PDFViewer } from "@ceereals/vue-pdf";
import { reactive } from "vue";
const viewStyle = reactive({
flexDirection: "row",
justifyContent: "center",
alignItems: "center",
height: "100%",
});
const textStyle = reactive({
fontSize: 24,
});
</script>
<template>
<PDFViewer>
<Document>
<Page size="A4">
<View :style="viewStyle">
<Text :style="textStyle">Hello, Vue PDF!</Text>
</View>
</Page>
</Document>
</PDFViewer>
</template>
Node
import { Document, Page, Text, View, renderToFile } from "@ceereals/vue-pdf";
import { defineComponent, h } from "@vue/runtime-core";
import fs from "fs";
const DocumentTemplate = defineComponent(() => {
return () => (
h(Document, [
h(Page, { size: "A4" }, [
h(
View, { style: viewStyle },
[
h(
Text, { style: textStyle },
"Hello, Vue PDF!",
),
],
),
]),
])
)
})
const stream = renderToFile(DocumentTemplate,'document.pdf');
Documentation
For more information, check out the documentation.
License
MIT © Riccardo Romoli
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 0.3.1 | MIT | |
| 0.3.0 | MIT | |
| 0.2.1 | MIT | |
| 0.2.0 | MIT | |
| 0.1.3 | MIT | |
| 0.0.12 | MIT | |
| 0.0.11 | MIT | |
| 0.0.10 | MIT | |
| 0.0.9 | MIT | |
| 0.0.8 | MIT | |
| 0.0.7 | MIT | |
| 0.0.6 | MIT | |
| 0.0.5 | MIT | |
| 0.0.4 | MIT | |
| 0.0.3 | MIT | |
| 0.0.2 | MIT |