Adds config-variable for pdf-export

- Adds the page-size 'A5' for pdf-export
This commit is contained in:
GabrielMeyer 2019-05-20 16:52:36 +02:00 committed by Emanuel Schütze
parent a09269cf2a
commit eb7b203b33
2 changed files with 18 additions and 2 deletions

View File

@ -165,12 +165,14 @@ export class PdfDocumentService {
this.initFonts(); this.initFonts();
this.imageUrls = imageUrls ? imageUrls : []; this.imageUrls = imageUrls ? imageUrls : [];
pdfMake.vfs = await this.initVfs(); pdfMake.vfs = await this.initVfs();
const pageSize = this.configService.instant('general_export_pdf_pagesize');
const defaultMargins = pageSize === 'A5' ? [45, 30, 45, 45] : [75, 90, 75, 75];
// needs to be done before, cause the footer is async // needs to be done before, cause the footer is async
this.loadFooterImages(); this.loadFooterImages();
const result = { const result = {
pageSize: 'A4', pageSize: pageSize || 'A4',
pageOrientation: landscape ? 'landscape' : 'portrait', pageOrientation: landscape ? 'landscape' : 'portrait',
pageMargins: customMargins || [75, 90, 75, 75], pageMargins: customMargins || defaultMargins,
defaultStyle: { defaultStyle: {
font: 'PdfFont', font: 'PdfFont',
fontSize: this.configService.instant('general_export_pdf_fontsize') fontSize: this.configService.instant('general_export_pdf_fontsize')

View File

@ -186,6 +186,20 @@ def get_config_variables():
subgroup="Export", subgroup="Export",
) )
yield ConfigVariable(
name="general_export_pdf_pagesize",
default_value="A4",
input_type="choice",
label="Standard page size in PDF",
choices=(
{"value": "A4", "display_name": "A4"},
{"value": "A5", "display_name": "A5"},
),
weight=147,
group="General",
subgroup="Export",
)
# Projector # Projector
yield ConfigVariable( yield ConfigVariable(