Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue 1836 #2776

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading