These issues were addressed in an email exchange. I report the suggested solution below:
One solution is to keep the container of the Canvas element in the page flow with appropriate dimensions so that other elements will know how to be positioned relative to it, but position the Canvas element itself outside of the flow so as to be able to center it. Here is how to do it:
newCanvas("myCanvas", 1240,520)
.cssContainer("height","520px") // make sure the 520px are vertically occupied in the flow
.css({position:'absolute',left:'50vw',transform:'translateX(-50%)'})
.add("center at 50%", 0, getImage("image"))
.center()
.print()
.log()
Jeremy