summaryrefslogtreecommitdiff
path: root/public/app/views/js/pdf/application-styler.php
diff options
context:
space:
mode:
authorGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-25 18:39:19 +0300
committerGeo Halkiadakis <gchalkiadakis@sklavenitis.co.gr>2023-05-25 18:39:19 +0300
commitddf8531d41856f1d941b5fd3e5b504b123bd6d44 (patch)
tree128b3c8ea2c45ddc0c1eb34cfc643fb30907e885 /public/app/views/js/pdf/application-styler.php
parentbbf8a78c35cb34237629a6745d158463451da383 (diff)
downloadgyraf1gov-ddf8531d41856f1d941b5fd3e5b504b123bd6d44.tar.gz
gyraf1gov-ddf8531d41856f1d941b5fd3e5b504b123bd6d44.tar.bz2
gyraf1gov-ddf8531d41856f1d941b5fd3e5b504b123bd6d44.zip
pdf templating for client-pdf-construction via makepdf
Diffstat (limited to 'public/app/views/js/pdf/application-styler.php')
-rw-r--r--public/app/views/js/pdf/application-styler.php191
1 files changed, 191 insertions, 0 deletions
diff --git a/public/app/views/js/pdf/application-styler.php b/public/app/views/js/pdf/application-styler.php
new file mode 100644
index 0000000..35077ef
--- /dev/null
+++ b/public/app/views/js/pdf/application-styler.php
@@ -0,0 +1,191 @@
+<!-- application pdf template
+ check: http://pdfmake.org/playground.html
+ // playground requires you to assign document definition to a variable called dd
+
+ var dd = {
+ content: [
+ 'APPLICATION:\n\n',
+ {
+ alignment: 'justify',
+ columns: [
+ {
+ text: [
+ 'NAME: My Name',
+ 'Father: I do',
+ 'Mother:Me too',
+ 'Specs: Some quite big Address Lorem ipsum dolor sit amet, consectetur adipisicing elit'
+ ].join('\n\n')
+ },
+ {
+ text:[
+ 'Lorem ipsum dolor sit amet, consectetur adipisicing elit.',
+ 'Malit profecta versatur nomine ocurreret multavit, officiis viveremus aeternum.',
+ 'Quando nostros congressus susceperant concederetur leguntur iam, vigiliae democritea tantopere causae.',
+ 'Atilii plerumque ipsas potitur pertineant multis rem quaeri pro, legendum didicisse credere ex maluisset per videtis.',
+ 'Cur discordans praetereat aliae ruinae dirigentur orestem eodem, praetermittenda divinum.',
+ 'Collegisti, deteriora malint loquuntur officii cotidie finitas referri doleamus ambigua acute.',
+ 'Adhaesiones ratione beate arbitraretur detractis perdiscere, constituant hostis polyaeno.',
+ 'Diu concederetur.'
+ ].join('\n')
+ }
+ ]
+ },
+ '\n\nOh, don\'t forget, we can use everything from styling examples (named styles, custom overrides) here as well.',
+ '\n\nWow, you\'ve read the whole document! Congratulations :D'
+ ],
+ styles: {
+ header: {
+ fontSize: 18,
+ bold: true
+ },
+ bigger: {
+ fontSize: 15,
+ italics: true
+ }
+ },
+ defaultStyle: {
+ columnGap: 20
+ }
+
+ }
+
+
+
+ --- also ---
+
+ var dd = {
+ content: [
+ {
+ text: 'This is a header with style',
+ style: 'header'
+ },
+
+ 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Confectum ponit legam, perferendis nomine miserum, animi. Moveat nesciunt triari naturam.\n\n',
+
+ 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Confectum ponit legam, perferendis nomine miserum, animi. Moveat nesciunt triari naturam posset, eveniunt specie deorsus efficiat sermone instituendarum fuisse veniat, eademque mutat debeo. Delectet plerique protervi diogenem dixerit logikh levius probabo adipiscuntur afficitur, factis magistra inprobitatem aliquo andriam obiecta, religionis, imitarentur studiis quam, clamat intereant vulgo admonitionem operis iudex stabilitas vacillare scriptum nixam, reperiri inveniri maestitiam istius eaque dissentias idcirco gravis, refert suscipiet recte sapiens oportet ipsam terentianus, perpauca sedatio aliena video.\n\n',
+
+ {
+ text: 'It is possible to apply multiple styles, by passing an array. This paragraph uses two styles: quote and small. When multiple styles are provided, they are evaluated in the specified order which is important in case they define the same properties',
+ style: ['quote', 'small']
+ }
+ ],
+ styles: {
+ header: {
+ fontSize: 18,
+ bold: true,
+ alignment: 'center'
+ },
+ subheader: {
+ fontSize: 15,
+ bold: true
+ },
+ quote: {
+ italics: true
+ },
+ small: {
+ fontSize: 8
+ }
+ }
+
+}
+-->
+
+
+
+<script>
+var source = {
+ first_name: 'George',
+ last_name: 'Its me!',
+ father_name: 'Pipis',
+ message: 'Adhaesiones ratione beate arbitraretur detractis perdiscere, constituant hostis polyaeno.',
+ constants: {
+ organization: 'Ministry of Nothing'
+ }
+}
+
+
+function designer(data) {
+ return {
+ content: [
+ {
+ text: 'ΑΙΤΗΣΗ\n\n',
+ style: 'header'
+ },
+ {
+ alignment: 'justify',
+ columns: [
+ {
+ width: 210,
+ text: ''
+ },
+ {
+ width: 'auto',
+ text:[
+ 'ΠΡΟΣ\n',
+ {
+ style: 'bigger',
+ text: data.constants.organization
+ }
+ ]
+ }
+ ]
+ },
+ {
+ alignment: 'justify',
+ columns: [
+ {
+ width: 210,
+ lineHeight: 1.5,
+ text: [
+ 'Όνομα: ', { style: 'bigger', text: data.first_name },
+ '\nΕπίθετο: ', { style: 'bigger', text: data.last_name },
+ '\nΌνομα πατρός: ',{ style: 'bigger', text: data.father_name },
+ '\nEmail: ', { style: 'bigger', text: data.email },
+ ]
+ },
+ {
+ width: 'auto',
+ lineHeight: 1.33,
+ text: [
+ '\n\n',
+ {
+ style: 'bigger',
+ text: data.message+'\n'
+ },
+ '\n\ndate: ',
+ '\n\nze Is',
+ '\n\n\n',
+ {
+ style: 'bigger',
+ text: data.last_name +' '+data.first_name
+ }
+ ]
+ }
+ ]
+ },
+ '\n\nOh, don\'t forget, we can use everything from styling examples (named styles, custom overrides) here as well.',
+ '\n\nWow, you\'ve read the whole document! Congratulations :D'
+ ],
+ styles: {
+ header: {
+ fontSize: 24,
+ bold: true,
+ alignment: 'center',
+ color: '#000'
+ },
+ bigger: {
+ fontSize: 15,
+ italics: false,
+ color: '#000'
+ }
+ },
+ defaultStyle: {
+ columnGap: 25,
+ fontSize: 13
+ }
+
+ };
+
+}
+
+var dd = designer(source);