How can I create a document with horizontal page orientation (landscape) using google doc api (in python if possible)
This one was hard. For future generations:
body = {
'title': 'Doc1'
}
doc = service.documents() \
.create(body=body).execute()
file_id = doc.get('documentId')
requests =[
{'updateDocumentStyle':{
"documentStyle":{
'pageSize':{
"height": {
'magnitude': 8.27,
'unit': 'PT'
},
"width": {
'magnitude': 11.69,
'unit': 'PT'
}
}},
"fields": 'pageSize'
}}]
result = service.documents().batchUpdate(
documentId=file_id, body={'requests': requests}).execute()