2013-06-19 18 views
1

我希望从电子表格生成安全的PDF,特别是设置安全选项以防止复制。Google apps脚本Pdf加密如何在Google App Engine上生成受保护的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"}; 
} 

是否有产生从谷歌驱动器或一个安全的PDF文件的方式是不是支持?

回答

0

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

+0

感谢您的回复,我感谢您的回复。我在电子邮件中附加了文档,并希望它成为pdf并受到复制保护 – Amany

相关问题