2017-04-03 20 views
1

私たちは、結合されたpdfをダウンロードし、次に個々の文書を抽出することを見ています(私の考えではない)。私はpdfsharpを私の結合したpdfに対して使ってみましたが、個々の文書に関するタイトル情報は表示されません。これが可能なのかどうか疑問に思っていただけです。 pdfsharpを使用すると、すべてのページを取り出すことができますが、どのページがドキュメントに属しているかを実際に知る方法はありません。Docusign combined pdf - 個々の文書を抽出できますか?

答えて

2

あなたが封筒から文書情報を読み、各文書のページ数を覚えてDocuSignのエンベロープを作成した後。これは、テンプレートを使用している場合にも有効です。

EnvelopeDocuments: list APIを使用すると、各ドキュメントのページを含むドキュメント情報を取得できます。次に、結合されたPDFから個々のドキュメントを抽出する必要がある場合は、個々のドキュメントをどこに分けるかが分かります。

{ 
    "envelopeDocuments": [ 
     { 
      "availableDocumentTypes": [ 
       { 
        "isDefault": "true", 
        "type": "electronic" 
       } 
      ], 
      "display": "inline", 
      "documentId": "1", 
      "includeInDownload": "true", 
      "name": "NDA.pdf", 
      "order": "1", 
      "pages": "3", 
      "signerMustAcknowledge": "no_interaction", 
      "type": "content", 
      "uri": "/envelopes/44efc9e6-915e-4b1d-9b54-801410d6922d/documents/1" 
     }, 
     { 
      "availableDocumentTypes": [ 
       { 
        "isDefault": "true", 
        "type": "electronic" 
       } 
      ], 
      "display": "inline", 
      "documentId": "2", 
      "includeInDownload": "true", 
      "name": "House.pdf", 
      "order": "2", 
      "pages": "1", 
      "signerMustAcknowledge": "no_interaction", 
      "type": "content", 
      "uri": "/envelopes/44efc9e6-915e-4b1d-9b54-801410d6922d/documents/2" 
     }, 
     { 
      "availableDocumentTypes": [ 
       { 
        "isDefault": "true", 
        "type": "electronic" 
       } 
      ], 
      "display": "inline", 
      "documentId": "3", 
      "includeInDownload": "true", 
      "name": "contractor_agreement.docx", 
      "order": "3", 
      "pages": "2", 
      "signerMustAcknowledge": "no_interaction", 
      "type": "content", 
      "uri": "/envelopes/44efc9e6-915e-4b1d-9b54-801410d6922d/documents/3" 
     }, 
     { 
      "availableDocumentTypes": [ 
       { 
        "isDefault": "true", 
        "type": "electronic" 
       } 
      ], 
      "display": "inline", 
      "documentId": "certificate", 
      "includeInDownload": "true", 
      "name": "Summary", 
      "order": "999", 
      "pages": "4", 
      "signerMustAcknowledge": "no_interaction", 
      "type": "summary", 
      "uri": "/envelopes/44efc9e6-915e-4b1d-9b54-801410d6922d/documents/certificate" 
     } 
    ], 
    "envelopeId": "44efc9e6-915e-4b1d-9b54-801410d6922d" 
} 
2

getEnvelopeDocuments apiには、封筒内のすべての文書をzipファイルとしてダウンロードするオプションがあります。ファイルを解凍して個々の文書を入手するだけで済みます。

GET /v2/accounts/{accountId}/envelopes/{envelopeId}/documents/archive 

は、PDF文書、証明書、および音声認証のために使用されるすべての.wavファイルをすべて含むZIPアーカイブを取得します。ここで


zipファイルをダウンロードし、Docusign C# SDKを使用して、それを解凍するためのサンプルコードです。

完全な例here

var envApi = new EnvelopesApi(); 

// GetDocument() API call returns a MemoryStream 
var docStream = envApi.GetDocument(accountId, envelopeId, "archive"); 
// let's save the document to local file system 
string zipName = Path.GetRandomFileName(); 
string zipfilePath = @"C:\temp\" + zipName + ".zip"; 
using (var fs = new FileStream(zipfilePath, FileMode.Create)) 
{ 
    docStream.Seek(0, SeekOrigin.Begin); 
    docStream.CopyTo(fs); 
} 

string extractPath = @"c:\temp\" + zipName; 
System.IO.Compression.ZipFile.ExtractToDirectory(zipfilePath, extractPath);   

編集(キャシー・ロリことで

何らかの理由で、私は、FileStreamオブジェクトにストリームをキャストする問題がありました。私が代わりにやったことは以下の通りであった:

Stream docStream = envApi.GetDocument(AccountId, envelopeId, "archive"); 
MemoryStream ret = new MemoryStream(); 

byte[] buffer = new byte[8192]; 
int bytesRead; 
while ((bytesRead = docStream.Read(buffer, 0, buffer.Length)) > 0) 
{ 
    ret.Write(buffer, 0, bytesRead); 
} 
ret.Position = 0; 

using (var fs = new FileStream(@"C:\temp\envelopeDocuments.zip", FileMode.Create)) 
{ 
    ret.CopyTo(fs); 
} 
+0

私はそのアーカイブオプションについては知りませんでした。ここで

は、リスト文書のサンプルAPIレスポンスを呼びました。知っておいてよかった。 –

+0

ここで私の知見を皆さんに提示し、彼らは決定を下すことができます。異なる方法で猫を肌に触れる方法を知っておくとよいでしょう。すべての助けに感謝します。 –

+0

うわー。私は音声認証機能があることを知らなかった。私はそれを使うつもりはないと思っていますが、将来必要があればそれはあります。 –

関連する問題