# GrapeCity.Documents.Pdf.OptimizeDocumentOptions

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions" class="text-break">OptimizeDocumentOptions Class
</h1>
  <div class="markdown level0 summary"><p>Represents options that control the behavior of the
<a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.Optimize.html#GrapeCity_Documents_Pdf_GcPdfDocument_Optimize_System_IO_Stream_GrapeCity_Documents_Pdf_OptimizeDocumentOptions_">Optimize(Stream, OptimizeDocumentOptions)</a> and
<a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.Optimize.html#GrapeCity_Documents_Pdf_GcPdfDocument_Optimize_System_String_GrapeCity_Documents_Pdf_OptimizeDocumentOptions_">Optimize(string, OptimizeDocumentOptions)</a> methods.</p>
</div>
  <div class="markdown level0 conceptual"></div>
  <div class="inheritance">
    <h5>Inheritance</h5>
    <div class="level0"><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
    <div class="level1"><span class="xref">OptimizeDocumentOptions</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="GrapeCity.Documents.Pdf.html">GrapeCity.Documents.Pdf</a></h6>
  <h6><strong>Assembly</strong>: DS.Documents.Pdf.dll</h6>
  <h5 id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public class OptimizeDocumentOptions</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Class OptimizeDocumentOptions</code></pre>
  </div>
  <h3 id="constructors">Constructors
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions__ctor" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.#ctor">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.-ctor.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions__ctor">OptimizeDocumentOptions()</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
    </tbody>
  </table>
  <h3 id="properties">Properties
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_CompressionLevel" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.CompressionLevel">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.CompressionLevel.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_CompressionLevel">CompressionLevel</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the compression level to use.</p>
<p>
Note: This value overrides the compression level specified by <a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.CompressionLevel.html#GrapeCity_Documents_Pdf_GcPdfDocument_CompressionLevel">CompressionLevel</a>.
</p>
<p>
The default value is <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.compression.compressionlevel#system-io-compression-compressionlevel-optimal">Optimal</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardEmbeddedFiles" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardEmbeddedFiles">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardEmbeddedFiles.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardEmbeddedFiles">DiscardEmbeddedFiles</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether the embedded files (<a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.EmbeddedFiles.html#GrapeCity_Documents_Pdf_GcPdfDocument_EmbeddedFiles">EmbeddedFiles</a>)
should be removed from the document.</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardEmbeddedPageThumbnails" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardEmbeddedPageThumbnails">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardEmbeddedPageThumbnails.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardEmbeddedPageThumbnails">DiscardEmbeddedPageThumbnails</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether embedded page thumbnails should be removed from the document.</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardJavaScriptActions" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardJavaScriptActions">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardJavaScriptActions.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardJavaScriptActions">DiscardJavaScriptActions</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether <a class="xref" href="GrapeCity.Documents.Pdf.Actions.ActionJavaScript.html">ActionJavaScript</a> actions should be removed from the document.</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardOutlines" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardOutlines">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardOutlines.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardOutlines">DiscardOutlines</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether all outlines should be removed from the document.</p>
<p>
When this property is set to <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>, the <a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.Outlines.html#GrapeCity_Documents_Pdf_GcPdfDocument_Outlines">Outlines</a> collection is cleared.
</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardSubmitImportResetActions" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardSubmitImportResetActions">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.DiscardSubmitImportResetActions.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_DiscardSubmitImportResetActions">DiscardSubmitImportResetActions</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether actions of the types
<a class="xref" href="GrapeCity.Documents.Pdf.Actions.ActionSubmitForm.html">ActionSubmitForm</a>, <a class="xref" href="GrapeCity.Documents.Pdf.Actions.ActionImportData.html">ActionImportData</a>, and <a class="xref" href="GrapeCity.Documents.Pdf.Actions.ActionResetForm.html">ActionResetForm</a>
should be removed from the document.</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_OptimizeFontsOptions" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.OptimizeFontsOptions">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.OptimizeFontsOptions.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_OptimizeFontsOptions">OptimizeFontsOptions</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets the options used to optimize fonts in the document.
The behavior is identical to the <a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.OptimizeFonts.html#GrapeCity_Documents_Pdf_GcPdfDocument_OptimizeFonts_GrapeCity_Documents_Pdf_OptimizeFontsOptions_">OptimizeFonts(OptimizeFontsOptions)</a> method.</p>
<p>
This property is ignored if <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.RemoveEmbeddedFonts.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_RemoveEmbeddedFonts">RemoveEmbeddedFonts</a> is set to <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.
</p>
<p>
By default, this property is not <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null">null</a> and contains a default instance of <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeFontsOptions.html">OptimizeFontsOptions</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_PdfStreamHandling" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.PdfStreamHandling">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.PdfStreamHandling.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_PdfStreamHandling">PdfStreamHandling</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets how existing PDF streams are handled when the document is saved.</p>
<p>
This setting is applicable only when optimizing an existing PDF that has been loaded.
</p>
<p>
The default value is <a class="xref" href="GrapeCity.Documents.Pdf.PdfStreamHandling.html#GrapeCity_Documents_Pdf_PdfStreamHandling_MinimizeSize">MinimizeSize</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_RemoveDuplicateImages" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.RemoveDuplicateImages">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.RemoveDuplicateImages.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_RemoveDuplicateImages">RemoveDuplicateImages</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether images with identical content should be removed from the document.</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_RemoveEmbeddedFonts" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.RemoveEmbeddedFonts">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.RemoveEmbeddedFonts.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_RemoveEmbeddedFonts">RemoveEmbeddedFonts</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether embedded fonts should be removed from the document.</p>
<p>
Note that a PDF may display incorrectly after embedded fonts are removed. Use with caution.
</p>
<p>
When this property is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">true</a>, the value of <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.OptimizeFontsOptions.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_OptimizeFontsOptions">OptimizeFontsOptions</a> is ignored.
</p>
<p>
The default value is <a href="https://learn.microsoft.com/dotnet/csharp/language-reference/builtin-types/bool">false</a>.
</p>
</td>
      </tr>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_UseObjectStreams" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.UseObjectStreams">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.UseObjectStreams.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_UseObjectStreams">UseObjectStreams</a>
        </td>
        <td class="markdown level1 summary"><p>Gets or sets whether to use object streams when saving the PDF.</p>
<p>
Using <a class="xref" href="GrapeCity.Documents.Pdf.UseObjectStreams.html#GrapeCity_Documents_Pdf_UseObjectStreams_Multiple">Multiple</a> (recommended) or <a class="xref" href="GrapeCity.Documents.Pdf.UseObjectStreams.html#GrapeCity_Documents_Pdf_UseObjectStreams_Single">Single</a>
can significantly reduce the size of the saved PDF in most cases.
</p>
This property is ignored and object streams are not used if:
<ul><li>The document is created using <a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.StartDoc.html#GrapeCity_Documents_Pdf_GcPdfDocument_StartDoc_System_IO_Stream_">StartDoc(Stream)</a> / <a class="xref" href="GrapeCity.Documents.Pdf.GcPdfDocument.EndDoc.html#GrapeCity_Documents_Pdf_GcPdfDocument_EndDoc">EndDoc()</a> methods.</li><li>The document is saved in linearized form.</li><li>The document uses a cross-reference table and is saved using incremental update.</li></ul>
<p>
The default value is <a class="xref" href="GrapeCity.Documents.Pdf.UseObjectStreams.html#GrapeCity_Documents_Pdf_UseObjectStreams_Single">Single</a>.
</p>
</td>
      </tr>
    </tbody>
  </table>
  <h3 id="methods">Methods
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="GrapeCity_Documents_Pdf_OptimizeDocumentOptions_SetForMinimumSize" data-uid="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.SetForMinimumSize">
          <a class="xref" href="GrapeCity.Documents.Pdf.OptimizeDocumentOptions.SetForMinimumSize.html#GrapeCity_Documents_Pdf_OptimizeDocumentOptions_SetForMinimumSize">SetForMinimumSize()</a>
        </td>
        <td class="markdown level1 summary"><p>Configures all optimization settings to minimize the resulting PDF size,
regardless of potential impact on quality or compatibility.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
