pdf template custom page size. (#1258)

This commit is contained in:
Eymen Elkum
2019-02-26 21:46:27 +03:00
committed by Yuri Kuznetsov
parent e38f967b1b
commit de78c92808
5 changed files with 41 additions and 3 deletions
@@ -14,6 +14,8 @@
"variables": "Available Placeholders",
"pageOrientation": "Page Orientation",
"pageFormat": "Paper Format",
"pageWidth": "Page Width (cm)",
"pageHeight": "Page Height (cm)",
"fontFace": "Font"
},
"links": {
@@ -26,6 +28,9 @@
"Portrait": "Portrait",
"Landscape": "Landscape"
},
"pageFormat": {
"Custom": "Custom Page Size"
},
"placeholders": {
"today": "Today (date)",
"now": "Now (date-time)"
@@ -14,10 +14,10 @@
[{"name":"header","fullWidth":true}],
[{"name":"body","fullWidth":true}],
[{"name":"pageOrientation"}, {"name":"pageFormat"}],
[{"name":"pageWidth"}, {"name":"pageHeight"}],
[{"name":"fontFace"}, false],
[{"name":"topMargin"}, false],
[{"name":"topMargin"}, {"name":"bottomMargin"}],
[{"name":"leftMargin"}, {"name":"rightMargin"}],
[{"name":"bottomMargin"}, false],
[{"name":"printFooter"}, false],
[{"name":"footer","fullWidth":true}],
[{"name":"footerPosition"}, false]
@@ -43,6 +43,28 @@
}
]
}
},
"pageWidth": {
"visible": {
"conditionGroup": [
{
"type": "equals",
"attribute": "pageFormat",
"value": "Custom"
}
]
}
},
"pageHeight": {
"visible": {
"conditionGroup": [
{
"type": "equals",
"attribute": "pageFormat",
"value": "Custom"
}
]
}
}
}
},
@@ -78,9 +78,17 @@
},
"pageFormat": {
"type": "enum",
"options": ["A3", "A4", "A5", "A6", "A7"],
"options": ["A3", "A4", "A5", "A6", "A7", "Custom"],
"default": "A4"
},
"pageWidth": {
"type": "int",
"min": 1
},
"pageHeight": {
"type": "int",
"min": 1
},
"fontFace": {
"type": "enum",
"options": [
+3
View File
@@ -109,6 +109,9 @@ class Pdf extends \Espo\Core\Services\Base
if ($template->get('pageFormat')) {
$pageFormat = $template->get('pageFormat');
}
if ($pageFormat === 'Custom') {
$pageFormat = [$template->get('pageWidth') * 10, $template->get('pageHeight') * 10];
}
$pageOrientationCode = 'P';
if ($pageOrientation === 'Landscape') {
$pageOrientationCode = 'L';