Skip to content

Commit

Permalink
Fixes issue 1836
Browse files Browse the repository at this point in the history
  • Loading branch information
fe-cj committed Sep 1, 2024
1 parent 1077279 commit 3ea28fd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 15 additions & 4 deletions src/ElementWriter.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,21 @@ class ElementWriter extends EventEmitter {
var v = pack(item.item);

offsetVector(v, useBlockXOffset ? (block.xOffset || 0) : ctx.x, useBlockYOffset ? (block.yOffset || 0) : ctx.y);
page.items.push({
type: 'vector',
item: v
});
if (v._isFillColorFromUnbreakable) {
// If the item is a fillColor from an unbreakable block
// We have to add it at the beginning of the items body array of the page
delete v._isFillColorFromUnbreakable;
const endOfBackgroundItemsIndex = ctx.backgroundLength[ctx.page];
page.items.splice(endOfBackgroundItemsIndex, 0, {
type: 'vector',
item: v
});
} else {
page.items.push({
type: 'vector',
item: v
});
}
break;

case 'image':
Expand Down
4 changes: 3 additions & 1 deletion src/TableProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,9 @@ class TableProcessor {
h: bgHeight,
lineWidth: 0,
color: fillColor,
fillOpacity: fillOpacity
fillOpacity: fillOpacity,
// mark if we are in an unbreakable block
_isFillColorFromUnbreakable: !!writer.transactionLevel
}, false, true, writer.context().backgroundLength[writer.context().page]);
}

Expand Down

0 comments on commit 3ea28fd

Please sign in to comment.