0
votes

While inserting an image in the google docs using google apps script, using class positioned image, the layout option does not have the option for setting the image behind text. If we insert and image through the doc, the text wrapping setting has an option for setting the image behind the text, how to access that using apps script.

The sample code is -

var body = DocumentApp.getActiveDocument().getBody(); var paragraph = body.appendParagraph("Text for Image ");

var image = "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2f/Google_2015_logo.svg/1920px-Google_2015_logo.svg.png"; var image = UrlFetchApp.fetch(image).getBlob();

paragraph.addPositionedImage(image)
  .setWidth(300)
  .setHeight(100)
  .setLayout(DocumentApp.PositionedLayout.)

The positioned layout class does not allow me to put the image behind the text while it has options for putting image in front of text as well as wrapping the text around the image.

Link for Positioned Layout Class - https://developers.google.com/apps-script/reference/document/positioned-layout

Link for Positioned Image Class - https://developers.google.com/apps-script/reference/document/positioned-image

1

1 Answers

0
votes

As you have noticed in the documentation, there is no attribute in order to place the image behind the text.

There is already an existing open issue on Issue Tracker regarding this. Therefore, I suggest you star this issue here and eventually add a comment saying that you are interested in it.