Pdf fixes
This commit is contained in:
parent
a9e0f36ab9
commit
9639d9233f
@ -88,7 +88,7 @@ angular.module('OpenSlidesApp.agenda.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
var filename = gettextCatalog.getString('Agenda') + '.pdf';
|
||||
var agendaContentProvider = AgendaContentProvider.createInstance(items);
|
||||
PdfMakeDocumentProvider.createInstance(agendaContentProvider).then(function (documentProvider) {
|
||||
PdfCreate.download(documentProvider.getDocument(), filename);
|
||||
PdfCreate.download(documentProvider, filename);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
@ -286,7 +286,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
// logo
|
||||
if (logoBallotPaperUrl) {
|
||||
columns.push({
|
||||
image: imageMap[logoBallotPaperUrl].data,
|
||||
image: logoBallotPaperUrl,
|
||||
fit: [90,20],
|
||||
width: '20%'
|
||||
});
|
||||
@ -506,6 +506,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
return createContentTable();
|
||||
};
|
||||
|
||||
var getImageMap = function () {
|
||||
return imageMap;
|
||||
};
|
||||
|
||||
return $q(function (resolve) {
|
||||
var imageSources = [
|
||||
logoBallotPaperUrl,
|
||||
@ -513,7 +517,8 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
ImageConverter.toBase64(imageSources).then(function (_imageMap) {
|
||||
imageMap = _imageMap;
|
||||
resolve({
|
||||
getContent: getContent
|
||||
getContent: getContent,
|
||||
getImageMap: getImageMap,
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -531,7 +536,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
'Config',
|
||||
function(gettextCatalog, PDFLayout, Config) {
|
||||
|
||||
var createInstance = function(allAssignmnets) {
|
||||
var createInstance = function(allAssignments) {
|
||||
|
||||
var title = PDFLayout.createTitle(
|
||||
Config.translate(Config.get('assignments_pdf_title').value)
|
||||
@ -575,10 +580,10 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
var assignmentContent = [];
|
||||
var assignmentTitles = [];
|
||||
|
||||
angular.forEach(allAssignmnets, function(assignment, key) {
|
||||
_.forEach(allAssignments, function(assignment, key) {
|
||||
assignmentTitles.push(assignment.title);
|
||||
assignmentContent.push(assignment.getContent());
|
||||
if (key < allAssignmnets.length - 1) {
|
||||
if (key < allAssignments.length - 1) {
|
||||
assignmentContent.push(PDFLayout.addPageBreak());
|
||||
}
|
||||
});
|
||||
@ -638,7 +643,7 @@ angular.module('OpenSlidesApp.assignments.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
PdfMakeDocumentProvider.createInstance(assignmentCatalogContentProvider);
|
||||
}
|
||||
documentProviderPromise.then(function (documentProvider) {
|
||||
PdfCreate.download(documentProvider.getDocument(), filename);
|
||||
PdfCreate.download(documentProvider, filename);
|
||||
});
|
||||
},
|
||||
createBallotPdf: function (assignment, pollId) {
|
||||
|
@ -166,11 +166,11 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
||||
* returns an array for content
|
||||
*/
|
||||
//images shall contain the the logos as URL: base64Str, just like the converter
|
||||
var createInstance = function(contentProvider) {
|
||||
var createInstance = function(contentProvider, noFooter) {
|
||||
// Logo urls
|
||||
var logoHeaderUrl = Config.get('logo_pdf_header').value.path,
|
||||
logoFooterUrl = Config.get('logo_pdf_footer').value.path;
|
||||
var imageMap = contentProvider.getImageMap();
|
||||
var imageMap = contentProvider.getImageMap ? contentProvider.getImageMap() : {};
|
||||
|
||||
// PDF header
|
||||
var getHeader = function() {
|
||||
@ -242,7 +242,7 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
||||
};
|
||||
};
|
||||
// Generates the document(definition) for pdfMake
|
||||
var getDocument = function(noFooter) {
|
||||
var getDocument = function() {
|
||||
var content = contentProvider.getContent();
|
||||
var standardFontsize = Config.get('general_export_pdf_fontsize').value;
|
||||
return {
|
||||
|
@ -301,7 +301,7 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
var userListContentProvider = UserListContentProvider.createInstance(users);
|
||||
PdfMakeDocumentProvider.createInstance(userListContentProvider).then(
|
||||
function (documentProvider) {
|
||||
PdfCreate.download(documentProvider.getDocument(), filename);
|
||||
PdfCreate.download(documentProvider, filename);
|
||||
}
|
||||
);
|
||||
},
|
||||
@ -309,10 +309,10 @@ angular.module('OpenSlidesApp.users.pdf', ['OpenSlidesApp.core.pdf'])
|
||||
var filename = gettextCatalog.getString('List of access data') + '.pdf';
|
||||
var userAccessDataListContentProvider = UserAccessDataListContentProvider.createInstance(
|
||||
users);
|
||||
PdfMakeDocumentProvider.createInstance(userAccessDataListContentProvider).then(
|
||||
// no footer here
|
||||
PdfMakeDocumentProvider.createInstance(userAccessDataListContentProvider, true).then(
|
||||
function (documentProvider) {
|
||||
var noFooter = true;
|
||||
PdfCreate.download(documentProvider.getDocument(noFooter), filename);
|
||||
PdfCreate.download(documentProvider, filename, true);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user