node.js - Google Drive API v3 - 将 doc 转换为 pdf

标签 node.js google-api google-drive-api pdf-generation

我正在尝试将 Google 文档文件转换为 pdf。

我尝试按照“迁移到 Google Drive v3”中的建议,将 files.copy 方法与资源中的 mimeType 一起使用 documentation 。但它不起作用:它只进行简单的复制而不进行转换。看起来好像从未考虑 mimeType...

gapi.client.drive.files.copy({
  name: 'My new PDF',
  fileId: sourceId,
  parents: [destinationId],
  mimeType: 'application/pdf'
})

(注意:我正在尝试在浏览器中执行此操作)

我也尝试过“text/plain”,但也没有改变。

更新:

看起来复制方法期间的转换只能转换为 Google 特定的 mimeType(文档、工作表等)

最佳答案

我认为这相当gapi.client.drive.files.export :

gapi.client.drive.files.export({fileId: sourceId, mimeType: "application/pdf"});

关于node.js - Google Drive API v3 - 将 doc 转换为 pdf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54622378/

相关文章:

javascript - 是否有任何原因导致我无法获取我的页面

node.js - NPM:不能要求全局安装的模块

c# - Google.Apis.Requests.RequestError - 需要 OAuth 2 访问 token

python - Gmail API 用户模拟(Python)

java - 如何以编程方式编辑 native 谷歌文档?

javascript - MongoDB find() 使用 mongoose 返回空 - node.js

node.js - Grunt.js : Fire livereload as soon a files are modified, 任务完成前

java - 关于在 Gmail 中实现搜索功能

google-sheets - SUMIF 不带删除线

google-drive-api - 搜索文件时 Google Drive API 调用出现问题