Fix empty PDF TOC page

Fixed a bug that occured, when the pdf TOC had no motions without a category.
In this case, an empty page, that was reserved for motions without category
was printed
This commit is contained in:
Sean Engelhardt 2019-08-22 10:47:37 +02:00
parent b80ac3ac68
commit 0939df17c9

View File

@ -127,6 +127,11 @@ export class MotionPdfCatalogService {
const motionToCurrentCat = motions.filter(motionIn => category === motionIn.category);
if (motionToCurrentCat && motionToCurrentCat.length) {
// if this is not the first page, start with a pagebreak
if (catTocBody.length) {
catTocBody.push(this.pdfService.getPageBreak());
}
catTocBody.push({
table: {
body: [
@ -165,8 +170,6 @@ export class MotionPdfCatalogService {
header ? JSON.parse(JSON.stringify(header)) : null
)
);
catTocBody.push(this.pdfService.getPageBreak());
}
}
@ -183,6 +186,7 @@ export class MotionPdfCatalogService {
// only push this array if there is at least one entry
if (uncatTocBody.length > 0) {
catTocBody.push(this.pdfService.getPageBreak());
catTocBody.push(this.pdfService.createTocTableDef(uncatTocBody, StyleType.CATEGORY_SECTION));
}