Acknowledging the rhetorical nature of this question, maybe better to ask:
Is there a work around to having to pre-analyze the size and location of and every shape and image being drawn to a 2d context to extract the maximum extents of the final drawing?
This seems to be the requirement in order to determine the proper scaling factor for the final context to ensure that nothing is drawn outside the canvas border, if so desired.
For drawings with a multitude of overlapping shapes and images, this seems like excessive computational overhead. As opposed to simply analyzing the resulting 1:1 "window image" once for the used pixel width and height.
Vice-versa, if the drawing is smaller than the canvas and you want to zoom to fill instead.
An zoom-to-extents function built into the canvas would be nice.
Is there a another way to do this?