Sometimes you need to prepare a Google Doc’s paper size and orientation programatically using Google Apps Script.
Unfortunately, you can’t just call for say, A4 in Landscape. Okay, not until now (see my code below).
Google Apps Script does provide a way to set the dimensions of your page in the body class by using:
The page widths and heights are measured in PostScripts Points which is a bit of a pain too.
Here is an example of setting and A3 paper size in Landscape.
var document = DocumentApp.getActiveDocument();
Ugh. What a chore. You need to find the dimensions of the paper in points.
Enter this little nifty function and your life will be so much easier: