Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Export a document as a PDF via app script api

Is there a way to export / serve a document as a PDF via the API in google app script?

I know there exists a download as pdf option, but I am not looking for that. I am looking to create a PDF document in google drive via the app script API.

like image 597
Gautam Avatar asked Mar 23 '23 04:03

Gautam


1 Answers

I use this:

oOutputFile.saveAndClose();
DocsList.createFile(oOutputFile.getAs('application/pdf')).rename(cOutputName+".pdf");

where oOutputFile is my Doc, and cOutputName is the name I want to give to the file.

Chris

like image 159
chris enn Avatar answered Apr 06 '23 13:04

chris enn