diff --git a/client/src/app/core/pdf-services/pdf-document.service.ts b/client/src/app/core/pdf-services/pdf-document.service.ts index f5be13ebf..a36a5980e 100644 --- a/client/src/app/core/pdf-services/pdf-document.service.ts +++ b/client/src/app/core/pdf-services/pdf-document.service.ts @@ -712,6 +712,13 @@ export class PdfDocumentService { }; } + public getSpacer(): Object { + return { + text: '', + margin: [0, 10] + }; + } + /** * Generates the table definition for the TOC * diff --git a/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.html b/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.html index 8c24485ea..35aa0e002 100644 --- a/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.html +++ b/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.html @@ -62,6 +62,7 @@ Table of contents Page numbers Current date + Enforce page breaks diff --git a/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.ts b/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.ts index 09dcb372c..cca2a1f99 100644 --- a/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.ts +++ b/client/src/app/site/motions/modules/shared-motion/motion-export-dialog/motion-export-dialog.component.ts @@ -65,7 +65,7 @@ export class MotionExportDialogComponent implements OnInit { private defaults: MotionExportInfo = { format: ExportFileFormat.PDF, content: ['text', 'reason'], - pdfOptions: ['toc', 'page'], + pdfOptions: ['toc', 'page', 'addBreaks'], metaInfo: ['submitters', 'state', 'recommendation', 'category', 'origin', 'tags', 'motion_block', 'polls'] }; diff --git a/client/src/app/site/motions/services/motion-pdf-catalog.service.ts b/client/src/app/site/motions/services/motion-pdf-catalog.service.ts index dbdf42683..0a12580cf 100644 --- a/client/src/app/site/motions/services/motion-pdf-catalog.service.ts +++ b/client/src/app/site/motions/services/motion-pdf-catalog.service.ts @@ -59,6 +59,8 @@ export class MotionPdfCatalogService { public motionListToDocDef(motions: ViewMotion[], exportInfo: MotionExportInfo): object { let doc = []; const motionDocList = []; + const printToc = exportInfo.pdfOptions.includes('toc'); + const enforcePageBreaks = exportInfo.pdfOptions.includes('addBreaks'); for (let motionIndex = 0; motionIndex < motions.length; ++motionIndex) { try { @@ -69,8 +71,10 @@ export class MotionPdfCatalogService { motionDocList.push(motionDocDef); - if (motionIndex < motions.length - 1) { + if (motionIndex < motions.length - 1 && enforcePageBreaks) { motionDocList.push(this.pdfService.getPageBreak()); + } else if (motionIndex < motions.length - 1 && !enforcePageBreaks) { + motionDocList.push(this.pdfService.getSpacer()); } } catch (err) { const errorText = `${this.translate.instant('Error during PDF creation of motion:')} ${ @@ -82,7 +86,7 @@ export class MotionPdfCatalogService { } // print extra data (title, preamble, categories, toc) only if there are more than 1 motion - if (motions.length > 1 && (!exportInfo.pdfOptions || exportInfo.pdfOptions.includes('toc'))) { + if (motions.length > 1 && (!exportInfo.pdfOptions || printToc)) { doc.push( this.pdfService.createTitle('motions_export_title'), this.pdfService.createPreamble('motions_export_preamble'),