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