That is a good question, and I will make a note to find a solution for that. Or at least a good answer why that is not possible. I am currently thinking about relative positioning and if that might pose a problem...
For the moment, this workaround should work:
$page = pgContent('Test');
addToBox(
$page,
box(
image('skala.png'),
['x' => 60, 'y' => 40, 'width' => 100]
)
);
However, if you are working with floating elements and relative positions, then it won't probably solve your problem?!
Update
After a detailed analysis, I can confirm that there is a systemtic limitation that disallows for using settings within addToBox()
.
Such settings can only be applied to the elements that are added. When using add()
with settings, a box()
will implicitly be added around the content. This box will then carry the settings. Therefore the above mentioned workaround is one official solution. The other is even more simple: Many elements can carry settings themselves.
$page = pgContent('Test');
addToBox(
$page,
image('skala.png', [
'x' => 60,
'y' => 40,
'width' => 100
])
);