# C1.C1Preview.C1PrintDocument.DocumentEndedScript

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="C1_C1Preview_C1PrintDocument_DocumentEndedScript_" data-uid="C1.C1Preview.C1PrintDocument.DocumentEndedScript*">DocumentEndedScript Property
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="C1_C1Preview_C1PrintDocument_DocumentEndedScript_" data-uid="C1.C1Preview.C1PrintDocument.DocumentEndedScript*"></a>
<h4 id="C1_C1Preview_C1PrintDocument_DocumentEndedScript" data-uid="C1.C1Preview.C1PrintDocument.DocumentEndedScript">DocumentEndedScript</h4>
<div class="markdown level1 summary"><p>Gets or sets the script that is executed when the current document has finished generating.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public string DocumentEndedScript { get; set; }</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Property DocumentEndedScript As String</code></pre>
</div>
<h5 id="C1_C1Preview_C1PrintDocument_DocumentEndedScript_remarks">Remarks</h5>
<div class="markdown level1 remarks"><pre><code>&lt;p&gt;
    &lt;xref href=&quot;C1.C1Preview.C1PrintDocument&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt; also fires the &lt;xref href=&quot;C1.C1Preview.C1PrintDocument.DocumentEnded&quot; data-throw-if-not-resolved=&quot;false&quot;&gt;&lt;/xref&gt; event at this time.
</code></pre>

    <p>
The difference between events and scripts is that event handlers
belong to the application code, while scripts belong to the document.
Thus it is recommended that event handlers be used to perform tasks that
implement the overall application logic but do not depend on the
specific document being processed.
</p>
    <p>
On the other hand, scripts should be used to perform tasks directly related
to the document itself. Scripts attached to a document are executed regardless
of the current application (e.g. when the document is regenerated after 
being loaded from file by a different program).
(For example, a document might contain a script that changes the value
of a field in that document when an error occurs.)
</p>
</div>
</div>
