# GrapeCity.Documents.Text.Font.CollectionFromStream

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Text_Font_CollectionFromStream_" data-uid="GrapeCity.Documents.Text.Font.CollectionFromStream*">CollectionFromStream Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Text_Font_CollectionFromStream_" data-uid="GrapeCity.Documents.Text.Font.CollectionFromStream*"></a>
<h4 id="GrapeCity_Documents_Text_Font_CollectionFromStream_System_IO_Stream_System_Collections_Generic_List_GrapeCity_Documents_Text_Font__System_Int32_System_Boolean_" data-uid="GrapeCity.Documents.Text.Font.CollectionFromStream(System.IO.Stream,System.Collections.Generic.List{GrapeCity.Documents.Text.Font},System.Int32,System.Boolean)">CollectionFromStream(Stream, List&lt;Font&gt;, int, bool)</h4>
<div class="markdown level1 summary"><p>Loads all <a class="xref" href="GrapeCity.Documents.Text.Font.html">Font</a>s from a specified stream containing single font or a font collection.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public static int CollectionFromStream(Stream stream, List&lt;Font&gt; fonts, int bytesToRead = -1, bool initCodeMap = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Shared Function CollectionFromStream(stream As Stream, fonts As List(Of Font), Optional bytesToRead As Integer = -1, Optional initCodeMap As Boolean = False) As Integer</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>The stream containing the font data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.collections.generic.list-1">List</a>&lt;<a class="xref" href="GrapeCity.Documents.Text.Font.html">Font</a>&gt;</td>
      <td><span class="parametername">fonts</span></td>
      <td><p>The destination list of fonts. It must be initialized beforehand.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">bytesToRead</span></td>
      <td><p>The number of bytes to read from the stream; -1 causes reading till the end of stream.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">initCodeMap</span></td>
      <td><p>Set this parameter to True if you're planning to add the loaded fonts to the fallback font collection.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><p>The number of loaded fonts.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
