Merge pull request #5443 from tsiegleauq/pdf-left-footer

Render left pdf footer image and page number
This commit is contained in:
Emanuel Schütze 2020-06-27 12:59:55 +02:00 committed by GitHub
commit fab51091b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -77,10 +77,14 @@ function addPageNumbers(data: any): void {
data.doc.footer = (currentPage, pageCount) => {
const footer = data.doc.tmpfooter;
// if the tmpfooter starts with an image, the pagenumber will be found in column 1
const pageNumberColIndex = !!footer.columns[0].image ? 1 : 0;
// "%PAGENR% needs to be found once. After that, the same position should always update page numbers"
if (footer.columns[0].stack[0] === '%PAGENR%' || countPageNumbers) {
if (footer.columns[pageNumberColIndex]?.stack[0] === '%PAGENR%' || countPageNumbers) {
countPageNumbers = true;
footer.columns[0].stack[0] = `${currentPage} / ${pageCount}`;
footer.columns[pageNumberColIndex].stack[0] = `${currentPage} / ${pageCount}`;
}
return footer;
};