문제

I'd like a snipe of code to convert a google docs text document template in a PDF file. I know how to create a new document as a google text document, but not how to transform it in a PDF file. I find this piece of code:

var pdf = UrlFetchApp.fetch("https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key="+key+"&exportFormat=pdf&gid=1&gridlines=0&printtitle=0&size=7&fzr=true&portrait=1&fitw=1", requestData).getBlob().setName(name);

  return pdf;

But I don't need spreadsheet customization (actually, I don't need spreadsheet, but text file).

How can I can do it? Only with UrlFetchApp.fetch class?

One more question: can I automaticaly send this PDF file to be printed after I've created it?

Thanks!

도움이 되었습니까?

해결책

If I understand you correctly your question is about getting a text document as pdf ?

There is a dedicated method for that :

DocsList.getFileById('document ID').getAs('application/pdf');

see related documentation here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top