Merge pull request #2935 from emanuelschuetze/motion-pdf-subtitle

PDF Layout improvements
This commit is contained in:
Emanuel Schütze 2017-02-06 14:44:06 +01:00 committed by GitHub
commit 12b50a0d68
3 changed files with 23 additions and 12 deletions

View File

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

View File

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

View File

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