Merge pull request #4726 from GabrielInTheWorld/pdf-make

Adds config-variable for pdf-export
This commit is contained in:
Emanuel Schütze 2019-05-21 12:23:38 +02:00 committed by GitHub
commit e907599cef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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(