我希望从电子表格生成安全的PDF,特别是设置安全选项以防止复制。
到目前为止,我生成了这样的PDF:
function convert(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getSheetByName("Sheet1");
var id = ss.getId();
var url = 'https://docs.google.com/feeds/';
var doc = UrlFetchApp.fetch(url+'download/spreadsheets/Export?key='+id+'&exportFormat=pdf',googleOAuth_('docs',url)).getBlob();//pdf
DocsList.createFile(doc).rename('pdfexport.pdf');
var pdffileID = DocsList.createFile(doc).getId()
var file = DocsList.getFileById(pdffileID);
Logger.log("file type : "+file.getFileType());
}
function googleOAuth_(name,scope){
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey('anonymous');
oAuthConfig.setConsumerSecret('anonymous');
return {oAuthServiceName:name, oAuthUseToken:"always"};
}
有没有办法从Google云端硬盘生成安全的PDF文件,还是不支持?
答案 0 :(得分:0)
看起来不直接支持。根据使用案例,您可以在Google文档中共享该文档的只读副本。