如何查看从 docusign 下载的 PDF 文件?
How do I view the PDF file downloaded from docusign?
我正在使用 docusign getDocument API 下载已签名的文档,但下载的文件格式很奇怪(json 根据 Content-type header ).这是什么格式,如何将其转换为 viewable/readable 格式。
这是回复的片段 -
%PDF-1.5\n%ûüýþ\n%写作 objects...\n4 0 obj\n<<\n/Type /Page\n/Resources 5 0 R\n/Parent 3 0 R\n/MediaBox [0 0 595.32000 841.92000 ]\n/Contents [6 0 R 7 0 R 8 0 R ]\n/Group <<\n/Type /Group\n/S /Transparency\n/CS /DeviceRGB\n>>\n/Tabs /S\n/StructParents 0\n>>\nendobj\n5 0 obj\n<<\n/Font <<\n/F1 9 0 R\n/F2 10 0 R\n/F3 11 0 R\n/F4 12 0 R\n/F5 13 0 R\n>>\n/ExtGState <<\n/GS7 14 0 R\n/GS8 15 0 R\n>>\n/ProcSet [/PDF /Text /ImageB /ImageC /ImageI ]\n/XObject <<\n/X0 16 0 R\n >>\n>>\nendobj\n2 0 obj\n<<\n/Producer (PDFKit.NET 21.1.200.20790)\n/CreationDate (D:20210429103256-07 '00')\n/ModDate (D:20210429103256-07'00')\n/Author ()\n/Creator ()\n/Keywords <>\n/S主题 ()\n/Title ()\n>>\nendobj\n6 0 obj\n<<\n/Length 4\n>>\nstream\n\n q \nendstream\nendobj\n7 0 obj\n<<\n/Filter /FlateDecode\n/Length 7326\n>>\nstream\nxœ½]ëo\u001c7'ÿnÀÿCã\u0016¸›YDm¾šd\u0007A\u0000É'\u001dçüZ[Þà\u0010ï\u0007Å'ma-É'FÉæ¿?
您使用的是什么语言,您使用的是 DocuSign SDK 之一还是原始 API 调用?
当我进行 GetDocument 调用时(例如 {{vx}}/accounts/{{accountid}}/envelopes/{{envelopeId}}/documents/combined
),响应 headers 有 Content-Type: application/pdf
和 Content-Dispostion: file; filename=file.pdf
,以及 body响应的是 PDF 文件本身的二进制文件。
我的一个片段以此开头:
%PDF-1.5
%����
%Writing objects...
4 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources 10 0 R
/MediaBox [0 0 612 792 ]
/Contents [11 0 R 12 0 R 13 0 R 14 0 R 15 0 R 16 0 R 17 0 R ]
/Group <<
/Type /Group
/S /Transparency
/CS /DeviceRGB
所以看起来无论您使用何种系统,响应都包括 \n
换行符和可能的其他控制字符。
您将想看看您的工具如何处理 API 响应:如果您可以将 DocuSign 的原始输出转储到 PDF 文件,那将可行,但注入额外的格式是不再有效。
我使用这段代码将 DocuSign getDocument API 的响应保存到 PDF 文档中-
envelopesApi.getDocument(ACCOUNT_ID, envelope_id, 'combined', function (error, document, response) {
if (document) {
var filename = ‘docusign.pdf';
fs.writeFile(filename, new Buffer(document, 'binary'), function (err) {
if (err) console.log('Error: ' + err);
});
}
});
我正在使用 docusign getDocument API 下载已签名的文档,但下载的文件格式很奇怪(json 根据 Content-type header ).这是什么格式,如何将其转换为 viewable/readable 格式。
这是回复的片段 -
%PDF-1.5\n%ûüýþ\n%写作 objects...\n4 0 obj\n<<\n/Type /Page\n/Resources 5 0 R\n/Parent 3 0 R\n/MediaBox [0 0 595.32000 841.92000 ]\n/Contents [6 0 R 7 0 R 8 0 R ]\n/Group <<\n/Type /Group\n/S /Transparency\n/CS /DeviceRGB\n>>\n/Tabs /S\n/StructParents 0\n>>\nendobj\n5 0 obj\n<<\n/Font <<\n/F1 9 0 R\n/F2 10 0 R\n/F3 11 0 R\n/F4 12 0 R\n/F5 13 0 R\n>>\n/ExtGState <<\n/GS7 14 0 R\n/GS8 15 0 R\n>>\n/ProcSet [/PDF /Text /ImageB /ImageC /ImageI ]\n/XObject <<\n/X0 16 0 R\n >>\n>>\nendobj\n2 0 obj\n<<\n/Producer (PDFKit.NET 21.1.200.20790)\n/CreationDate (D:20210429103256-07 '00')\n/ModDate (D:20210429103256-07'00')\n/Author ()\n/Creator ()\n/Keywords <>\n/S主题 ()\n/Title ()\n>>\nendobj\n6 0 obj\n<<\n/Length 4\n>>\nstream\n\n q \nendstream\nendobj\n7 0 obj\n<<\n/Filter /FlateDecode\n/Length 7326\n>>\nstream\nxœ½]ëo\u001c7'ÿnÀÿCã\u0016¸›YDm¾šd\u0007A\u0000É'\u001dçüZ[Þà\u0010ï\u0007Å'ma-É'FÉæ¿?
您使用的是什么语言,您使用的是 DocuSign SDK 之一还是原始 API 调用?
当我进行 GetDocument 调用时(例如 {{vx}}/accounts/{{accountid}}/envelopes/{{envelopeId}}/documents/combined
),响应 headers 有 Content-Type: application/pdf
和 Content-Dispostion: file; filename=file.pdf
,以及 body响应的是 PDF 文件本身的二进制文件。
我的一个片段以此开头:
%PDF-1.5
%����
%Writing objects...
4 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources 10 0 R
/MediaBox [0 0 612 792 ]
/Contents [11 0 R 12 0 R 13 0 R 14 0 R 15 0 R 16 0 R 17 0 R ]
/Group <<
/Type /Group
/S /Transparency
/CS /DeviceRGB
所以看起来无论您使用何种系统,响应都包括 \n
换行符和可能的其他控制字符。
您将想看看您的工具如何处理 API 响应:如果您可以将 DocuSign 的原始输出转储到 PDF 文件,那将可行,但注入额外的格式是不再有效。
我使用这段代码将 DocuSign getDocument API 的响应保存到 PDF 文档中-
envelopesApi.getDocument(ACCOUNT_ID, envelope_id, 'combined', function (error, document, response) {
if (document) {
var filename = ‘docusign.pdf';
fs.writeFile(filename, new Buffer(document, 'binary'), function (err) {
if (err) console.log('Error: ' + err);
});
}
});