I'm trying to place an image against the right-hand margin of a google doc using scripts. I've got this calculation for the left offset:
body.getPageWidth()-body.getMarginRight()-body.getMarginLeft()-myImage.imageWidth
This consistently places the image 5/8 of an inch inside the margin. I thought maybe this might be something to do with the automatic margin around a wrapped image? I can't find a way to control that in the PositionedImage documentation though.
Is there an extra element I'm missing in my calculation for the left offset? Something else I'm failing to allow for? Is there another method I can use to place the image?