title: to attach a pdf/other file at time of envelope creation / draft envelope in Docusign
body: <p>The objective is to attach a pdf/other file at time of envelope creation / draft envelope. I am using PHP5 Docusign.</p>
  <p>Please find attached herewith &quot;create_proposal.php&quot; as &quot;create_proposal.txt&quot; for reference.</p>
  <pre><code>// instantiate a new envelope attachment
  $content_bytes = file_get_contents(&quot;test.pdf&quot;);
  $doc1_b64 = base64_encode($content_bytes);
  
  $document1 = new \DocuSign\eSign\Model\Document([ # create the DocuSign document object
  'document_base64' =&gt; $doc1_b64,
  'name' =&gt; 'Order acknowledgement', # can be different from actual file name
  'file_extension' =&gt; 'pdf', # many different document types are accepted
  'document_id' =&gt; '1' # a label used to reference the doc
  ]);
  
  $envelop_definition-&gt;setDocuments([$document1]);
  </code></pre>
  <p>The response is :</p>
  <pre><code>&lt;pre&gt;DocuSign\eSign\Client\ApiException Object
  (
  [responseBody:protected] =&gt; O:8:&quot;stdClass&quot;:2:{s:9:&quot;errorCode&quot;;s:33:&quot;TAB_PAGENUMBER_IS_NOT_IN_DOCUMENT&quot;;s:7:&quot;message&quot;;s:134:&quot;The pagenumber specified in the tab element is not in the document that the tab refers to. Tab on Page 4 of Document 1 for Recipient 1&quot;;}
  [responseHeaders:protected] =&gt; Array
  (
  [0] =&gt; HTTP/1.1 400 Bad Request
  [Cache-Control] =&gt; no-cache
  [Content-Length] =&gt; 196
  [Content-Type] =&gt; application/json; charset=utf-8
  [X-RateLimit-Reset] =&gt; 1604228400
  [X-RateLimit-Remaining] =&gt; 992
  [X-RateLimit-Limit] =&gt; 1000
  [X-BurstLimit-Remaining] =&gt; 499
  [X-BurstLimit-Limit] =&gt; 500
  [X-DocuSign-TraceToken] =&gt; 943befbf-c776-4d03-a091-be5202acede7
  [X-DocuSign-Node] =&gt; DA4FE36
  [Date] =&gt; Sun, 01 Nov 2020 10:10:54 GMT
  [Vary] =&gt; Accept-Encoding
  )
  </code></pre>
  <p>Please provide solution. Thanks.</p>