PDF Layout improvements

- Added parent motion into subtitle of motion pdf.
  (for amendments only).
- Adapted page margin and footer.
- Use same line height also for outside line numbering.
- Add more margin-top for motion reason heading.
This commit is contained in:
Emanuel Schütze 2017-02-06 12:32:15 +01:00
parent 45c3da22f9
commit 80b9ce138f
3 changed files with 23 additions and 12 deletions

View File

@ -42,6 +42,7 @@ self.addEventListener('message', function(e) {
return { return {
text: footerText, text: footerText,
alignment: data.footerTpl.alignment, alignment: data.footerTpl.alignment,
margin: data.footerTpl.margin,
fontSize: data.footerTpl.fontSize, fontSize: data.footerTpl.fontSize,
color: data.footerTpl.color color: data.footerTpl.color
}; };

View File

@ -26,7 +26,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
// page subtitle // page subtitle
PDFLayout.createSubtitle = function(subtitle) { PDFLayout.createSubtitle = function(subtitle) {
return { return {
text: subtitle, text: subtitle.join('\n'),
style: "subtitle" style: "subtitle"
}; };
}; };
@ -156,7 +156,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
return { return {
color: '#555', color: '#555',
fontSize: 9, fontSize: 9,
margin: [80, 30, 80, 10], // [left, top, right, bottom] margin: [75, 30, 75, 10], // [left, top, right, bottom]
columns: columns, columns: columns,
columnGap: 10 columnGap: 10
}; };
@ -168,11 +168,11 @@ angular.module('OpenSlidesApp.core.pdf', [])
// are replaced by dynamic footer function in pdf-worker.js. // are replaced by dynamic footer function in pdf-worker.js.
var getFooter = function() { var getFooter = function() {
return { return {
alignment: 'center', alignment: 'right',
fontSize: 8, margin: [0, 15, 75, 0],
fontSize: 9,
color: '#555', color: '#555',
text: gettextCatalog.getString('Page') + text: '{{currentPage}} / {{pageCount}}'
' {{currentPage}} / {{pageCount}}'
}; };
}; };
// Generates the document(definition) for pdfMake // Generates the document(definition) for pdfMake
@ -180,7 +180,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
var content = contentProvider.getContent(); var content = contentProvider.getContent();
return { return {
pageSize: 'A4', pageSize: 'A4',
pageMargins: [80, 90, 80, 100], pageMargins: [75, 90, 75, 100],
defaultStyle: { defaultStyle: {
font: 'PdfFont', font: 'PdfFont',
fontSize: 10 fontSize: 10
@ -625,6 +625,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
] ]
}; };
currentParagraph = create("text"); currentParagraph = create("text");
currentParagraph.lineHeight = 1.25;
col.columns.push(currentParagraph); col.columns.push(currentParagraph);
alreadyConverted.push(col); alreadyConverted.push(col);
} }

View File

@ -9,7 +9,8 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
'PDFLayout', 'PDFLayout',
'Category', 'Category',
'Config', 'Config',
function(gettextCatalog, PDFLayout, Category, Config) { 'Motion',
function(gettextCatalog, PDFLayout, Category, Config, Motion) {
/** /**
* Provides the content as JS objects for Motions in pdfMake context * Provides the content as JS objects for Motions in pdfMake context
* @constructor * @constructor
@ -25,9 +26,16 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
); );
// subtitle // subtitle
var subtitle = PDFLayout.createSubtitle( var subtitleLines = [];
gettextCatalog.getString('Sequential number') + ': ' + motion.id if (motion.parent_id) {
); var parentMotion = Motion.get(motion.parent_id);
subtitleLines.push(
gettextCatalog.getString('Amendment of motion') + ': ' +
(parentMotion.identifier ? parentMotion.identifier : parentMotion.getTitle())
);
}
subtitleLines.push(gettextCatalog.getString('Sequential number') + ': ' + motion.id);
var subtitle = PDFLayout.createSubtitle(subtitleLines);
// meta data table // meta data table
var metaTable = function() { var metaTable = function() {
@ -269,7 +277,8 @@ angular.module('OpenSlidesApp.motions.pdf', ['OpenSlidesApp.core.pdf'])
if (motion.getReason($scope.version)) { if (motion.getReason($scope.version)) {
reason.push({ reason.push({
text: gettextCatalog.getString('Reason'), text: gettextCatalog.getString('Reason'),
style: 'heading3' style: 'heading3',
marginTop: 25,
}); });
reason.push(converter.convertHTML(motion.getReason($scope.version), $scope.lineNumberMode)); reason.push(converter.convertHTML(motion.getReason($scope.version), $scope.lineNumberMode));
} }