# C1.C1Preview.Utils

## Content

<div class="doc-site-dotnet-api-container">



  <h1 id="C1_C1Preview_Utils" data-uid="C1.C1Preview.Utils" class="text-break">Utils Class
</h1>
  <div class="markdown level0 summary"><p>Contains common functions.</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">Utils</span></div>
  </div>
  <h6><strong>Namespace</strong>: <a class="xref" href="C1.C1Preview.html">C1.C1Preview</a></h6>
  <h6><strong>Assembly</strong>: C1.WPF.PrintDocument.4.6.2.dll</h6>
  <h5 id="C1_C1Preview_Utils_syntax">Syntax</h5>
  <div class="codewrapper">
    <pre><code class="lang-csharp hljs">public static class Utils</code></pre>
  </div>
  <div class="codewrapper">
    <pre><code class="lang-vbnet hljs">Public Module Utils</code></pre>
  </div>
  <h3 id="fields">Fields
</h3>
  <table class="table table-bordered table-condensed">
    <thead>
      <tr>
        <th>Name</th>
        <th>Description</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td id="C1_C1Preview_Utils_BlackColor" data-uid="C1.C1Preview.Utils.BlackColor">
          <a class="xref" href="C1.C1Preview.Utils.BlackColor.html">BlackColor</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use only.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_CmPerInch" data-uid="C1.C1Preview.Utils.CmPerInch">
          <a class="xref" href="C1.C1Preview.Utils.CmPerInch.html">CmPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Centimeters per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_CmPerInchF" data-uid="C1.C1Preview.Utils.CmPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.CmPerInchF.html">CmPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Centimeters per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_DipPerInch" data-uid="C1.C1Preview.Utils.DipPerInch">
          <a class="xref" href="C1.C1Preview.Utils.DipPerInch.html">DipPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>DIP (device independent pixel 1/96inch) per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_DisplayPerInch" data-uid="C1.C1Preview.Utils.DisplayPerInch">
          <a class="xref" href="C1.C1Preview.Utils.DisplayPerInch.html">DisplayPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Display units per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_DisplayPerInchF" data-uid="C1.C1Preview.Utils.DisplayPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.DisplayPerInchF.html">DisplayPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Display units per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_DocumentUnitsPerInch" data-uid="C1.C1Preview.Utils.DocumentUnitsPerInch">
          <a class="xref" href="C1.C1Preview.Utils.DocumentUnitsPerInch.html">DocumentUnitsPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Document units per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_DocumentUnitsPerInchF" data-uid="C1.C1Preview.Utils.DocumentUnitsPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.DocumentUnitsPerInchF.html">DocumentUnitsPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Document units per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_MmPerInch" data-uid="C1.C1Preview.Utils.MmPerInch">
          <a class="xref" href="C1.C1Preview.Utils.MmPerInch.html">MmPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Millimeters per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_MmPerInchF" data-uid="C1.C1Preview.Utils.MmPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.MmPerInchF.html">MmPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Millimeters per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_PicaPerInch" data-uid="C1.C1Preview.Utils.PicaPerInch">
          <a class="xref" href="C1.C1Preview.Utils.PicaPerInch.html">PicaPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Picas per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_PicaPerInchF" data-uid="C1.C1Preview.Utils.PicaPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.PicaPerInchF.html">PicaPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Picas per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_PointsPerInch" data-uid="C1.C1Preview.Utils.PointsPerInch">
          <a class="xref" href="C1.C1Preview.Utils.PointsPerInch.html">PointsPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Points per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_PointsPerInchF" data-uid="C1.C1Preview.Utils.PointsPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.PointsPerInchF.html">PointsPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Points per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_TransparentColor" data-uid="C1.C1Preview.Utils.TransparentColor">
          <a class="xref" href="C1.C1Preview.Utils.TransparentColor.html">TransparentColor</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use only.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_TwipsFC" data-uid="C1.C1Preview.Utils.TwipsFC">
          <a class="xref" href="C1.C1Preview.Utils.TwipsFC.html">TwipsFC</a>
        </td>
        <td class="markdown level1 summary"></td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_TwipsPerInch" data-uid="C1.C1Preview.Utils.TwipsPerInch">
          <a class="xref" href="C1.C1Preview.Utils.TwipsPerInch.html">TwipsPerInch</a>
        </td>
        <td class="markdown level1 summary"><p>Twips per inch as double.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_TwipsPerInchF" data-uid="C1.C1Preview.Utils.TwipsPerInchF">
          <a class="xref" href="C1.C1Preview.Utils.TwipsPerInchF.html">TwipsPerInchF</a>
        </td>
        <td class="markdown level1 summary"><p>Twips per inch as float.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_WhiteColor" data-uid="C1.C1Preview.Utils.WhiteColor">
          <a class="xref" href="C1.C1Preview.Utils.WhiteColor.html">WhiteColor</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use only.</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="C1_C1Preview_Utils_AsC1Document_System_Object_" data-uid="C1.C1Preview.Utils.AsC1Document(System.Object)">
          <a class="xref" href="C1.C1Preview.Utils.AsC1Document.html#C1_C1Preview_Utils_AsC1Document_System_Object_">AsC1Document(object)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <span class="xref">C1.C1Preview.IC1Document</span> representing the passed object,
If the passed document is a <a class="xref" href="C1.C1Preview.C1PrintDocument.html">C1PrintDocument</a> or <a class="xref" href="C1.C1Preview.C1MultiDocument.html">C1MultiDocument</a>, returns that object.
Otherwise, returns <b>null</b>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_AsC1PrintDocument_System_Object_" data-uid="C1.C1Preview.Utils.AsC1PrintDocument(System.Object)">
          <a class="xref" href="C1.C1Preview.Utils.AsC1PrintDocument.html#C1_C1Preview_Utils_AsC1PrintDocument_System_Object_">AsC1PrintDocument(object)</a>
        </td>
        <td class="markdown level1 summary"><p>Gets the <a class="xref" href="C1.C1Preview.C1PrintDocument.html">C1PrintDocument</a> representing the passed object,
If the passed document is a <a class="xref" href="C1.C1Preview.C1PrintDocument.html">C1PrintDocument</a>, returns that object.
Otherwise, returns <b>null</b>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_ConvertUnits_System_Double_C1_C1Preview_UnitTypeEnum_C1_C1Preview_UnitTypeEnum_System_Single_System_Single_" data-uid="C1.C1Preview.Utils.ConvertUnits(System.Double,C1.C1Preview.UnitTypeEnum,C1.C1Preview.UnitTypeEnum,System.Single,System.Single)">
          <a class="xref" href="C1.C1Preview.Utils.ConvertUnits.html#C1_C1Preview_Utils_ConvertUnits_System_Double_C1_C1Preview_UnitTypeEnum_C1_C1Preview_UnitTypeEnum_System_Single_System_Single_">ConvertUnits(double, UnitTypeEnum, UnitTypeEnum, float, float)</a>
        </td>
        <td class="markdown level1 summary"><p>Converts a value from one unit of measurement to another.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_FromWpfColor_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.FromWpfColor(System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.FromWpfColor.html#C1_C1Preview_Utils_FromWpfColor_System_Windows_Media_Color_">FromWpfColor(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use only.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_GetResourceImage_System_String_" data-uid="C1.C1Preview.Utils.GetResourceImage(System.String)">
          <a class="xref" href="C1.C1Preview.Utils.GetResourceImage.html#C1_C1Preview_Utils_GetResourceImage_System_String_">GetResourceImage(string)</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsC1Document_System_Object_" data-uid="C1.C1Preview.Utils.IsC1Document(System.Object)">
          <a class="xref" href="C1.C1Preview.Utils.IsC1Document.html#C1_C1Preview_Utils_IsC1Document_System_Object_">IsC1Document(object)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether an object can be represented as a <span class="xref">C1.C1Preview.IC1Document</span>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsC1DocumentType_System_Type_" data-uid="C1.C1Preview.Utils.IsC1DocumentType(System.Type)">
          <a class="xref" href="C1.C1Preview.Utils.IsC1DocumentType.html#C1_C1Preview_Utils_IsC1DocumentType_System_Type_">IsC1DocumentType(Type)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether an object of the specified type can be represented
as a <span class="xref">C1.C1Preview.IC1Document</span>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsC1PrintDocument_System_Object_" data-uid="C1.C1Preview.Utils.IsC1PrintDocument(System.Object)">
          <a class="xref" href="C1.C1Preview.Utils.IsC1PrintDocument.html#C1_C1Preview_Utils_IsC1PrintDocument_System_Object_">IsC1PrintDocument(object)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether an object can be represented as a <a class="xref" href="C1.C1Preview.C1PrintDocument.html">C1PrintDocument</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsC1PrintDocumentType_System_Type_" data-uid="C1.C1Preview.Utils.IsC1PrintDocumentType(System.Type)">
          <a class="xref" href="C1.C1Preview.Utils.IsC1PrintDocumentType.html#C1_C1Preview_Utils_IsC1PrintDocumentType_System_Type_">IsC1PrintDocumentType(Type)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether an object of the specified type can be represented
as a <a class="xref" href="C1.C1Preview.C1PrintDocument.html">C1PrintDocument</a>.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorBlack_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.IsColorBlack(System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorBlack.html#C1_C1Preview_Utils_IsColorBlack_System_Drawing_Color_">IsColorBlack(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is black.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorBlack_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.IsColorBlack(System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorBlack.html#C1_C1Preview_Utils_IsColorBlack_System_Windows_Media_Color_">IsColorBlack(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is black.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorEmpty_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.IsColorEmpty(System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorEmpty.html#C1_C1Preview_Utils_IsColorEmpty_System_Drawing_Color_">IsColorEmpty(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether the specified color is invisible
(i.e. equals <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color.empty">Empty</a> or <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color.transparent">Transparent</a>).</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorEmpty_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.IsColorEmpty(System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorEmpty.html#C1_C1Preview_Utils_IsColorEmpty_System_Windows_Media_Color_">IsColorEmpty(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Returns true if specified color is Transparent (Colors.Transparent).</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorEquals_System_Drawing_Color_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.IsColorEquals(System.Drawing.Color,System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorEquals.html#C1_C1Preview_Utils_IsColorEquals_System_Drawing_Color_System_Drawing_Color_">IsColorEquals(Color, Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified colors are equal.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorEquals_System_Windows_Media_Color_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.IsColorEquals(System.Windows.Media.Color,System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorEquals.html#C1_C1Preview_Utils_IsColorEquals_System_Windows_Media_Color_System_Windows_Media_Color_">IsColorEquals(Color, Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified colors are equal.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorTransparent_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.IsColorTransparent(System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorTransparent.html#C1_C1Preview_Utils_IsColorTransparent_System_Drawing_Color_">IsColorTransparent(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is transparent.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorTransparent_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.IsColorTransparent(System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorTransparent.html#C1_C1Preview_Utils_IsColorTransparent_System_Windows_Media_Color_">IsColorTransparent(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is transparent.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorWhite_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.IsColorWhite(System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorWhite.html#C1_C1Preview_Utils_IsColorWhite_System_Drawing_Color_">IsColorWhite(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is white.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_IsColorWhite_System_Windows_Media_Color_" data-uid="C1.C1Preview.Utils.IsColorWhite(System.Windows.Media.Color)">
          <a class="xref" href="C1.C1Preview.Utils.IsColorWhite.html#C1_C1Preview_Utils_IsColorWhite_System_Windows_Media_Color_">IsColorWhite(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests whether specified color is white.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_Round_C1_C1Preview_PointD_" data-uid="C1.C1Preview.Utils.Round(C1.C1Preview.PointD)">
          <a class="xref" href="C1.C1Preview.Utils.Round.html#C1_C1Preview_Utils_Round_C1_C1Preview_PointD_">Round(PointD)</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_Round_C1_C1Preview_RectangleD_" data-uid="C1.C1Preview.Utils.Round(C1.C1Preview.RectangleD)">
          <a class="xref" href="C1.C1Preview.Utils.Round.html#C1_C1Preview_Utils_Round_C1_C1Preview_RectangleD_">Round(RectangleD)</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_SamePaperSizes_System_Drawing_SizeF_System_Drawing_SizeF_" data-uid="C1.C1Preview.Utils.SamePaperSizes(System.Drawing.SizeF,System.Drawing.SizeF)">
          <a class="xref" href="C1.C1Preview.Utils.SamePaperSizes.html#C1_C1Preview_Utils_SamePaperSizes_System_Drawing_SizeF_System_Drawing_SizeF_">SamePaperSizes(SizeF, SizeF)</a>
        </td>
        <td class="markdown level1 summary"><p>Tests two sizes for equality allowing a small margin for rounding errors.</p>
</td>
      </tr>
      <tr>
        <td id="C1_C1Preview_Utils_ToWpfColor_System_Drawing_Color_" data-uid="C1.C1Preview.Utils.ToWpfColor(System.Drawing.Color)">
          <a class="xref" href="C1.C1Preview.Utils.ToWpfColor.html#C1_C1Preview_Utils_ToWpfColor_System_Drawing_Color_">ToWpfColor(Color)</a>
        </td>
        <td class="markdown level1 summary"><p>For internal use only.</p>
</td>
      </tr>
    </tbody>
  </table>

</div>
