Přidáno generování pdfka.
This commit is contained in:
Generated
+579
-198
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"serve": "vue-cli-service serve --host 0.0.0.0",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
@@ -12,6 +12,7 @@
|
||||
"core-js": "^3.6.5",
|
||||
"jspdf": "^2.3.0",
|
||||
"v-click-outside": "^3.1.2",
|
||||
"pdfmake": "^0.1.70",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.2.0"
|
||||
},
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button v-on:click="createPdf">Generate a PDF</button>
|
||||
<iframe :src="pdfSrc" width="1000" height="1000" frameborder="0"></iframe>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -85,6 +87,10 @@
|
||||
import NavBar from '@/components/edit/NavBar.vue'
|
||||
import Hlava from '@/components/edit/Hlava.vue'
|
||||
|
||||
import pdfMake from "pdfmake/build/pdfmake";
|
||||
import pdfFonts from "pdfmake/build/vfs_fonts";
|
||||
pdfMake.vfs = pdfFonts.pdfMake.vfs;
|
||||
|
||||
export default {
|
||||
name: 'Edit',
|
||||
components: {
|
||||
@@ -101,6 +107,7 @@ export default {
|
||||
},
|
||||
data: () => {
|
||||
return {
|
||||
pdfSrc: "",
|
||||
zaloba: {
|
||||
soud: {
|
||||
nazev: "Obvodní soudu pro Prahu 4",
|
||||
@@ -166,6 +173,164 @@ export default {
|
||||
title: "Žaloba"
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
createPdf: function () {
|
||||
const dd = {
|
||||
content: [
|
||||
{
|
||||
text: this.zaloba.soud.nazev,
|
||||
style: 'adresa'
|
||||
},
|
||||
{
|
||||
text: this.zaloba.soud.sidlo.uliceacislopopisne,
|
||||
style: "adresa"
|
||||
},
|
||||
{
|
||||
text: this.zaloba.soud.sidlo.psc + " " + this.zaloba.soud.sidlo.mesto,
|
||||
style: "adresa"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
text: this.zaloba.title,
|
||||
style: "bigtitle"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
text: this.zaloba.zalobci.length === 1 ? "Žalobce: " : "Žalobci: "
|
||||
},
|
||||
...this.zaloba.zalobci.map(e => [
|
||||
{
|
||||
text: `${e.jmeno} ${e.prijmeni}, rč.: ${e.rodnecisloneboico}`,
|
||||
style: "zalobce"
|
||||
},
|
||||
{
|
||||
text: `${e.sidlo.uliceacislopopisne}, ${e.sidlo.psc}, ${e.sidlo.mesto}`,
|
||||
style: "zalobce"
|
||||
},
|
||||
...typeof e.zastoupen !== "undefined" ? [
|
||||
{
|
||||
text: "Zastoupen: ",
|
||||
style: "zalobce"
|
||||
},
|
||||
{
|
||||
text: `${e.zastoupen.jmeno} ${e.zastoupen.prijmeni}, IČO: ${e.rodnecisloneboico}`,
|
||||
style: "zastupce"
|
||||
},
|
||||
{
|
||||
text: `${e.zastoupen.sidlo.uliceacislopopisne}, ${e.zastoupen.sidlo.psc}, ${e.zastoupen.sidlo.mesto}`,
|
||||
style: "zastupce"
|
||||
}
|
||||
] : [{}],
|
||||
{
|
||||
text: "",
|
||||
style: "separator"
|
||||
}
|
||||
]).flat(),
|
||||
|
||||
{
|
||||
text: this.zaloba.zalobci.length === 1 ? "Žalovaný: " : "Žalovaní: "
|
||||
},
|
||||
...this.zaloba.zalovani.map(e => [
|
||||
{
|
||||
text: `${e.jmeno} ${e.prijmeni}, rč.: ${e.rodnecisloneboico}`,
|
||||
style: "zalobce"
|
||||
},
|
||||
{
|
||||
text: `${e.sidlo.uliceacislopopisne}, ${e.sidlo.psc}, ${e.sidlo.mesto}`,
|
||||
style: "zalobce"
|
||||
},
|
||||
...typeof e.zastoupen !== "undefined" ? [
|
||||
{
|
||||
text: "Zastoupen: ",
|
||||
style: "zalobce"
|
||||
},
|
||||
{
|
||||
text: `${e.zastoupen.jmeno} ${e.zastoupen.prijmeni}, IČO: ${e.rodnecisloneboico}`,
|
||||
style: "zastupce"
|
||||
},
|
||||
{
|
||||
text: `${e.zastoupen.sidlo.uliceacislopopisne}, ${e.zastoupen.sidlo.psc}, ${e.zastoupen.sidlo.mesto}`,
|
||||
style: "zastupce"
|
||||
}
|
||||
] : [{}],
|
||||
{
|
||||
text: "",
|
||||
style: "separator"
|
||||
}
|
||||
]).flat(),
|
||||
|
||||
{
|
||||
text: this.zaloba.title,
|
||||
style: "smalltitle"
|
||||
},
|
||||
...this.zaloba.hlavy.map(e => [
|
||||
{
|
||||
text: e.nazev,
|
||||
style: "smalltitle"
|
||||
},
|
||||
{
|
||||
text: e.text
|
||||
}
|
||||
]).flat(),
|
||||
|
||||
{
|
||||
text: `Dne ${this.zaloba.datum} v České republice`,
|
||||
alignment: "right",
|
||||
margin: [0, 30, 0, 0]
|
||||
},
|
||||
{
|
||||
text: "__________________________",
|
||||
alignment: "right",
|
||||
margin: [0, 30, 0, 0]
|
||||
|
||||
}
|
||||
],
|
||||
defaultStyle: {
|
||||
font: 'SourceSerifPro'
|
||||
},
|
||||
styles: {
|
||||
adresa: {
|
||||
bold: true,
|
||||
alignment: "right"
|
||||
},
|
||||
zalobce: {
|
||||
margin: [15, 0, 0, 0]
|
||||
},
|
||||
zastupce: {
|
||||
margin: [20, 0, 0, 0]
|
||||
},
|
||||
separator: {
|
||||
margin: [0,16,0,0]
|
||||
},
|
||||
bigtitle: {
|
||||
fontSize: 20,
|
||||
bold: true,
|
||||
alignment: "center",
|
||||
margin: [0,16,0,16]
|
||||
},
|
||||
smalltitle: {
|
||||
bold: true,
|
||||
alignment: "center",
|
||||
margin: [0, 10, 0, 10]
|
||||
}
|
||||
}
|
||||
}
|
||||
pdfMake.fonts = {
|
||||
SourceSerifPro: {
|
||||
normal: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Regular.ttf",
|
||||
bold: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Bold.ttf",
|
||||
italics: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-Italic.ttf",
|
||||
bolditalics: "https://github.com/google/fonts/raw/89ade4fa7b7663aec69d3202d2eefd928e78c467/ofl/sourceserifpro/SourceSerifPro-BoldItalic.ttf",
|
||||
}
|
||||
}
|
||||
pdfMake.createPdf(dd).getDataUrl((dataUrl) => {
|
||||
this.pdfSrc = dataUrl;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user