【问题标题】:Docusign Document blank after API callAPI调用后Docusign文档空白
【发布时间】:2018-11-19 19:58:28
【问题描述】:

我正在通过 Request to docusign 拨打电话,如下所示:

 var options = {
    method: 'GET',
    url: `${baseUrl}/envelopes/${envelopeId}/documents/${documentId}`,
    headers: headers,
    qs: {
        encoding: 'base64'
    }
};

request(options, function (error, response, body) {
...
})

我正在取回文档字符串,但是当我将其写入 .pdf 时,我得到 4 个空白页。这是我用来将其写入文件的代码:

fs.writeFile('cert.pdf', body, (err) => {
            if(err) throw new Error(err)
        })

Nodejs -v 8.11.1

【问题讨论】:

标签: node.js docusignapi


【解决方案1】:

两个问题:

  1. 我会省略qs: {encoding: 'base64'} 选项。该文档将作为二进制文件返回。 (这就是你想要的。)

  2. 写入文件时,请指定二进制格式。在 Linux 系统上,没有区别。但在 Windows 上有。

有关检索文档的代码示例,请参阅this file

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-02
    相关资源
    最近更新 更多