Google应用脚本Pdf加密如何在Google App Engine上生成受保护的PDF? [英] Google apps script Pdf encryption How to generate secured PDF on Google App Engine?

查看:156
本文介绍了Google应用脚本Pdf加密如何在Google App Engine上生成受保护的PDF?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望从电子表格中生成安全的PDF,特别是设置安全选项以防止复制。

I wish to generate a secured PDF from a spreadsheet, In particular, setting up the security options to prevent copying.

到目前为止,我生成的PDF格式如下:

So far, I generate PDFs like this:

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文件,它支持?

Is there a way to generate a secured PDF file from Google Drive or isn't it supported?

推荐答案

它看起来不像直接支持。根据使用情况,您可以在Google文档中分享文档的只读副本。

It does not look like this is supported directly. Depending on the use case, you could share a read only copy of the document in Google Docs.

这篇关于Google应用脚本Pdf加密如何在Google App Engine上生成受保护的PDF?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆