Fixes some PDF issues
This commit is contained in:
parent
c5be76ace2
commit
9448beb903
@ -56,7 +56,7 @@ General:
|
|||||||
- Several bugfixes and minor improvements.
|
- Several bugfixes and minor improvements.
|
||||||
- Improved performance for pdf generation significantly (by upgrading
|
- Improved performance for pdf generation significantly (by upgrading
|
||||||
to pdfmake 0.1.30) [#3278, #3285].
|
to pdfmake 0.1.30) [#3278, #3285].
|
||||||
- Bugfixes for PDF creation [#3227, #3251, #3279]
|
- Bugfixes for PDF creation [#3227, #3251, #3279, #3286]
|
||||||
|
|
||||||
|
|
||||||
Version 2.1.1 (2017-04-05)
|
Version 2.1.1 (2017-04-05)
|
||||||
|
@ -730,27 +730,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
} else {
|
} else {
|
||||||
lineNumberOutline = element.getAttribute("data-line-number");
|
lineNumberOutline = element.getAttribute("data-line-number");
|
||||||
}
|
}
|
||||||
var lineNumberObject = {
|
|
||||||
width: 20,
|
|
||||||
text: [
|
|
||||||
{
|
|
||||||
text: ' ', // Add a blank with the normal font size here, so in rare cases the text
|
|
||||||
// is rendered on the next page and the linenumber on the previous page.
|
|
||||||
fontSize: 10,
|
|
||||||
decoration: '',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
text: lineNumberOutline,
|
|
||||||
color: "gray",
|
|
||||||
fontSize: 8,
|
|
||||||
decoration: '',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
margin: [0, 2, 0, 0]
|
|
||||||
};
|
|
||||||
var col = {
|
var col = {
|
||||||
columns: [
|
columns: [
|
||||||
lineNumberObject,
|
getLineNumberObject(lineNumberOutline),
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
currentParagraph = create("text");
|
currentParagraph = create("text");
|
||||||
@ -769,9 +751,6 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
//in case of inline-line-numbers and the os-line-break class ignore the break
|
//in case of inline-line-numbers and the os-line-break class ignore the break
|
||||||
if ((lineNumberMode == "inline" &&
|
if ((lineNumberMode == "inline" &&
|
||||||
element.getAttribute("class") == "os-line-break") ||
|
element.getAttribute("class") == "os-line-break") ||
|
||||||
(lineNumberMode == "outside" &&
|
|
||||||
element.getAttribute("class") == "os-line-break" &&
|
|
||||||
brParent.getAttribute("class") == "insert") ||
|
|
||||||
(lineNumberMode == "outside" &&
|
(lineNumberMode == "outside" &&
|
||||||
element.getAttribute("class") == "os-line-break" &&
|
element.getAttribute("class") == "os-line-break" &&
|
||||||
brParent.getAttribute("class") == "merge-before")) {
|
brParent.getAttribute("class") == "merge-before")) {
|
||||||
@ -800,10 +779,9 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
case "p":
|
case "p":
|
||||||
var pObjectToPush; //determine what to push later
|
var pObjectToPush; //determine what to push later
|
||||||
currentParagraph = create("text");
|
currentParagraph = create("text");
|
||||||
if (classes.indexOf("merge-before") > -1) {
|
currentParagraph.margin = [20, 0, 0, 0];
|
||||||
currentParagraph.marginTop = 0;
|
if (classes.indexOf("merge-before") === -1) {
|
||||||
} else {
|
currentParagraph.margin[1] = 8;
|
||||||
currentParagraph.marginTop = 8;
|
|
||||||
}
|
}
|
||||||
currentParagraph.lineHeight = 1.25;
|
currentParagraph.lineHeight = 1.25;
|
||||||
var stackP = create("stack");
|
var stackP = create("stack");
|
||||||
@ -815,7 +793,6 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
if (element.childNodes.length > 0) { //if we hit = 0, the code would fail
|
if (element.childNodes.length > 0) { //if we hit = 0, the code would fail
|
||||||
// add empty line number column for inline diff or pragraph diff mode
|
// add empty line number column for inline diff or pragraph diff mode
|
||||||
if (element.childNodes[0].tagName === "INS" ||
|
if (element.childNodes[0].tagName === "INS" ||
|
||||||
element.getAttribute("class") === "insert" ||
|
|
||||||
element.childNodes[0].tagName === "DEL") {
|
element.childNodes[0].tagName === "DEL") {
|
||||||
var pLineNumberPlaceholder = {
|
var pLineNumberPlaceholder = {
|
||||||
width: 20,
|
width: 20,
|
||||||
@ -880,20 +857,13 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
currentParagraph = parseChildren(list[nodeName], element, currentParagraph, styles, diff_mode);
|
currentParagraph = parseChildren(list[nodeName], element, currentParagraph, styles, diff_mode);
|
||||||
if (lines.length > 0) {
|
if (lines.length > 0) {
|
||||||
var listCol = {
|
var listCol = {
|
||||||
columns: [{
|
columns: [{
|
||||||
width: 20,
|
|
||||||
stack: []
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
_.forEach(lines, function(line) {
|
|
||||||
listCol.columns[0].stack.push({
|
|
||||||
width: 20,
|
width: 20,
|
||||||
text: line,
|
stack: []
|
||||||
color: "gray",
|
}]
|
||||||
fontSize: 8,
|
};
|
||||||
lineHeight: 1.25,
|
_.forEach(lines, function(line) {
|
||||||
margin: [0, 2.85, 0, 0]
|
listCol.columns[0].stack.push(getLineNumberObject(line));
|
||||||
});
|
|
||||||
});
|
});
|
||||||
listCol.columns.push(list);
|
listCol.columns.push(list);
|
||||||
listCol.margin = [0,10,0,0];
|
listCol.margin = [0,10,0,0];
|
||||||
@ -933,6 +903,27 @@ angular.module('OpenSlidesApp.core.pdf', [])
|
|||||||
ParseElement(converted, element, null, [], DIFF_MODE_NORMAL);
|
ParseElement(converted, element, null, [], DIFF_MODE_NORMAL);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
/* Returns the object to push first into every column, that represents the given line. */
|
||||||
|
getLineNumberObject = function (line) {
|
||||||
|
return {
|
||||||
|
width: 20,
|
||||||
|
text: [
|
||||||
|
{
|
||||||
|
text: ' ', // Add a blank with the normal font size here, so in rare cases the text
|
||||||
|
// is rendered on the next page and the linenumber on the previous page.
|
||||||
|
fontSize: 10,
|
||||||
|
decoration: '',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: line,
|
||||||
|
color: "gray",
|
||||||
|
fontSize: 8,
|
||||||
|
decoration: '',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
lineHeight: 1.25,
|
||||||
|
};
|
||||||
|
},
|
||||||
content = [];
|
content = [];
|
||||||
ParseHtml(content, html);
|
ParseHtml(content, html);
|
||||||
return content;
|
return content;
|
||||||
|
Loading…
Reference in New Issue
Block a user