我指的是这里的C#示例:http://iodocs.docusign.com/APIWalkthrough/getEnvelopeDocuments
这个API实际上根据服务器上的信封ID下载文档。
然而,对于我的用例,我想知道是否有一种方法通过API通过URL来检索文档,而不是下载到服务器。
发布于 2014-05-07 14:28:05
虽然不可能通过URL直接链接到DocuSign文档,但当用户单击站点上的链接时,可以在浏览器中显示文档(而不必下载到服务器)。这样做只需要链接的onClick,您的代码通过API从DocuSign请求文档(如示例所示),然后立即将响应流(字节数组)写入浏览器(而不是将其写入文件)。
通过将"// read the response and store into a local file:“部分替换为如下内容(在链接到的代码示例中),您应该能够做到这一点:
// Write the response stream to the browser (render PDF in browser).
HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse();
byte[] b = null;
using (Stream stream = webResponse.GetResponseStream())
using (MemoryStream ms = new MemoryStream())
{
int count = 0;
do
{
byte[] buf = new byte[1024];
count = stream.Read(buf, 0, 1024);
ms.Write(buf, 0, count);
} while (stream.CanRead && count > 0);
b = ms.ToArray();
}
Response.BufferOutput = true;
Response.ClearHeaders();
Response.AddHeader("content-disposition", "inline;filename=DSfile.pdf");
Response.ContentType = "application/pdf";
Response.BinaryWrite(b);
Response.Flush();
Response.End();https://stackoverflow.com/questions/23496544
复制相似问题