samedi 31 janvier 2015

Insert Image as Large as Possible in Google Doc using App Script


I'm trying to automate putting images in a Google Doc with Google App Script. I want an image (taken from drive) to take up as much space on the page as possible. I tried to do this with...



var element = cursor.insertInlineImage(image);
if (element) {
//element.setBold(true);
element.setHeight(DocumentApp.getActiveDocument().getBody().getPageHeight());
element.setWidth(DocumentApp.getActiveDocument().getBody().getPageWidth());
} else {
DocumentApp.getUi().alert('Cannot insert image at this cursor location.');
}


This causes a border on the left and bottom of about two inches. As I'm using a page with no margins, it should report the entire page size, but it's not. Is there any way to do this in Google App Script?


Thank you.





Aucun commentaire:

Enregistrer un commentaire