下载签名的 PDF 返回损坏的文件 - Docusign API PHP

问题描述 投票:0回答:1

尝试通过 PHP SDK 从 Docusign 下载签名的 PDF 文件。 API 调用返回成功,文件已下载但已损坏,无法打开或显示任何内容。

代码如下:

try {
            $envelopesApi = new EnvelopesApi($apiClient);
            $response = $envelopesApi->getDocument('ACCOUNT_ID', $documentId, $envelopeId);

            $fileContents = $response->getPathName();

            // Save the downloaded document to a file or process it as needed
            file_put_contents('path/filename.pdf', $fileContents);

            echo 'Signed document downloaded successfully.';
        } catch (ApiException $e) {
            echo 'Error while downloading the signed document: ' . $e->getMessage();
        }
        die;
php symfony docusignapi
1个回答
0
投票

好的所以要正确下载PDF,替换:

$fileContents = $response->getPathName();

$fileContents = file_get_contents($response->getPathName());
© www.soinside.com 2019 - 2024. All rights reserved.