Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions Document-Processing-toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -4687,7 +4687,7 @@
<a href="/document-processing/word/word-library/net/Working-with-SmartArts">Working with SmartArts</a>
</li>
<li>
<a href="/document-processing/word/word-library/net/Working-with-Ink">Working with Inks</a>
<a href="/document-processing/word/word-library/net/Working-with-Ink">Working with Ink</a>
</li>
<li>
<a href="/document-processing/word/word-library/net/Working-with-Charts">Working with Charts</a>
Expand Down Expand Up @@ -7711,6 +7711,14 @@
</li>
</ul>
</li>
<li>
Common
<ul>
<li>
<a href="/document-processing/common/font-manager/font-manager">Font Manager</a>
</li>
</ul>
</li>
<li>
<a href="/document-processing/web-apis/overview">Web APIs</a>
<ul>
Expand Down Expand Up @@ -7784,9 +7792,6 @@
<li>
<a href="/document-processing/frequently-asked-question">FAQ</a>
<ul>
<li>
<a href="/document-processing/faq/how-does-syncfusion-document-processing-manage-fonts">How does Syncfusion Document Processing manage fonts during Office to PDF/Image conversions and PDF processing workflows?</a>
</li>
<li>
<a href="/document-processing/faq/how-to-resolve-libskiasharp-not-found-exception-in-net8-and-net9-on-linux">How to resolve LibSkiaSharp not found exception specifically while using SkiaSharp version upto v2.88.8 in .NET 8 and .NET 9 applications hosted on AWS Linux?</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ platform: document-processing
documentation: UG
---

# How Syncfusion manage fonts in Office-to-PDF/image and PDF processing?
# Font Manager for Office-to-PDF/Image and PDF Processing

## Overview

Expand All @@ -15,45 +15,58 @@ To address this challenge, Syncfusion Document Processing libraries introduce th

## Key Features

* Shared font caching: Stores fonts in a unified cache to prevent repeated loading across operations.
* Memory reduction: Eliminates duplicate font objects, reducing memory usage during large-scale or parallel document conversions.
* Performance optimization: Enables multiple threads to safely reuse the same font instances, improving processing speed.
* Automatic cleanup: Automatically disposes unused fonts after a configurable delay (FontManager.Delay) to maintain efficiency in long-running applications.
* Manual cache management: Provides FontManager.ClearCache() to immediately clear all cached fonts when needed (e.g., during server shutdown).
* **Shared font caching:** Stores fonts in a unified cache to prevent repeated loading across operations.
* **Memory reduction:** Eliminates duplicate font objects, reducing memory usage during large-scale or parallel document conversions.
* **Performance optimization:** Enables multiple threads to safely reuse the same font instances, improving processing speed.
* **Automatic cleanup:** Automatically disposes unused fonts after a configurable delay (FontManager.Delay) to maintain efficiency in long-running applications.
* **Manual cache management:** Provides FontManager.ClearCache() to immediately clear all cached fonts when needed (e.g., during server shutdown).

## Supported Conversions and Workflows

FontManager optimizes memory usage across the following Office to PDF/Image conversions and PDF processing scenarios:

### Office Document Conversions

**Word Library (DocIO)**

* Word to PDF conversion.
* Word to Image conversion.

**Excel Library (XlsIO)**

* Excel to PDF conversion.
* Excel to Image conversion.

**PowerPoint Library (Presentation)**

* PowerPoint to PDF conversion.
* PowerPoint to Image conversion.

### PDF Processing Workflows

**PDF Library Operations**

* PDF creation and manipulation
* PDF merging and splitting
* PDF form filling and flattening
* PDF page extraction and insertion
* Adding text, images, and annotations to PDF
* PDF redaction and security
* PDF/A conformance
* OCR text extraction
<table>
<tr>
<th>Category</th>
<th>Details</th>
</tr>
<tr>
<td><b>Office Document Conversions</b></td>
<td>
<b>Word Library (DocIO)</b>
<ul>
<li>Word to PDF conversion.</li>
<li>Word to Image conversion.</li>
</ul>
<b>Excel Library (XlsIO)</b>
<ul>
<li>Excel to PDF conversion.</li>
<li>Excel to Image conversion.</li>
</ul>
<b>PowerPoint Library (Presentation)</b>
<ul>
<li>PowerPoint to PDF conversion.</li>
<li>PowerPoint to Image conversion.</li>
</ul>
</td>
</tr>
<tr>
<td><b>PDF Processing Workflows</b></td>
<td>
<b>PDF Library Operations</b>
<ul>
<li>PDF creation and manipulation</li>
<li>PDF merging and splitting</li>
<li>PDF form filling and flattening</li>
<li>PDF page extraction and insertion</li>
<li>Adding text, images, and annotations to PDF</li>
<li>PDF redaction and security</li>
<li>PDF/A conformance</li>
<li>OCR text extraction</li>
</ul>
</td>
</tr>
</table>

N> FontManager automatically manages fonts across all these conversion types, whether you're processing a single document or handling thousands of concurrent conversions in a multi-threaded environment.

Expand All @@ -66,7 +79,7 @@ The `FontManager.Delay` property defines the duration (in milliseconds) after wh

N> This configuration is optional. By default, unused fonts are automatically cleaned up 30 seconds after their references are released. To customize the delay, set this property at the application startup (e.g., in `Startup.cs` or `Program.cs`).

### Example: Basic Configuration
The following example demonstrates how to configure `FontManager.Delay` to automatically release cached fonts after the specified delay during document conversions.

{% tabs %}
{% highlight C# %}
Expand All @@ -79,9 +92,7 @@ FontManager.Delay = 50000;
{% endhighlight %}
{% endtabs %}

### Example: ASP.NET Core Application

The following example demonstrates how to configure `FontManager.Delay` in an ASP.NET Core application to ensure cached fonts are automatically released after the specified delay during document conversions.
The following example demonstrates how to configure `FontManager.Delay` in an **ASP.NET Core application** to ensure cached fonts are automatically released after the specified delay during document conversions.

{% tabs %}

Expand Down Expand Up @@ -118,7 +129,7 @@ The `FontManager.ClearCache()` method immediately clears all font caches managed
* Before maintenance operations.
* When immediate memory reclamation is required.

### Example: Basic Usage
The following example demonstrates how to immediately clear all cached fonts using `FontManager.ClearCache()`.

{% tabs %}
{% highlight C# %}
Expand All @@ -131,7 +142,7 @@ FontManager.ClearCache();
{% endhighlight %}
{% endtabs %}

### Example: ASP.NET Core Application Shutdown
The following example demonstrates how to configure `FontManager.ClearCache()` in an **ASP.NET Core application** to clear cached fonts during application shutdown.

{% tabs %}
{% highlight C# %}
Expand All @@ -145,7 +156,6 @@ var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
// Register a callback to clear font cache during application shutdown
lifetime.ApplicationStopping.Register(() =>
{

Syncfusion.Drawing.Fonts.FontManager.ClearCache();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Linked text boxes are not supported.
Ink elements
</td>
<td>
Supported only in DOCX format document to image.
Supported only in DOCX format document to image. Additional behavior explained {{ '[here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/unsupported-elements-word-to-pdf#ink)' | markdownify }}.
</td>
</tr>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ Linked text boxes are not supported.
Ink elements
</td>
<td>
Supported only in DOCX format document to PDF.
Supported only in DOCX format document to PDF. Additional behavior explained {{ '[here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/unsupported-elements-word-to-pdf#ink)' | markdownify }}.
</td>
</tr>
</table>
Expand Down Expand Up @@ -245,6 +245,12 @@ SmartArt typically contains graphic properties, including bounds information for

Creating, editing, or cloning Drawing Canvas elements programmatically is not supported. These elements are not included in Find and Replace functionality or document comparison. Additionally, when opening Word 2003 or 2007 DOCX documents, the Drawing Canvas is treated as a group shape.

### Ink

During Word-to-PDF and Word-to-Image conversions, Syncfusion Word Library uses fallback images embedded in the document to preserve the Ink visual appearance. However, when Ink is created or modified using the Syncfusion Word Library, some Ink effects cannot be rendered accurately due to rendering engine limitations. Although the Ink stroke geometry is preserved, visual brush effects are lost.

**To resolve this**, save the created or modified document using DocIO first in DOCX format. Then, open the saved document in Microsoft Word and save it again. Finally, convert it to PDF or Image using DocIO. This process regenerates the required Ink fallback images, ensuring accurate visual output.

## Show Warning for Unsupported Elements

When converting a Word document to a PDF, the presence of unsupported elements in the input Word document can lead to preservation issues in the converted PDF. The .NET Word library (DocIO) contains [Warning](https://help.syncfusion.com/cr/document-processing/Syncfusion.DocToPDFConverter.DocToPDFConverterSettings.html#Syncfusion_DocToPDFConverter_DocToPDFConverterSettings_Warning) API, which helps to detect and handle these unsupported elements during the conversion process. This API holds the information of unsupported elements once found in the input Word document.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ Yes<br/><br/></td></tr>
Ink elements<br/><br/></td><td>
No<br/><br/></td><td>
No<br/><br/></td><td>
DOCX format only.<br/><br/></td><td>
DOCX format only.<br/><br/></td><td>
DOCX format only. Additional behavior explained {{'[here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/unsupported-elements-word-to-pdf#ink)'| markdownify }}<br/><br/></td><td>
DOCX format only. Additional behavior explained {{'[here](https://help.syncfusion.com/document-processing/word/conversions/word-to-pdf/net/unsupported-elements-word-to-pdf#ink)'| markdownify }}<br/><br/></td><td>
No<br/><br/></td><td>
No<br/><br/></td></tr>
</tbody>
Expand Down Expand Up @@ -1139,7 +1139,7 @@ Yes<br/><br/></td></tr>
<tr><td>AutoTextList field</td><td>No</td></tr>
<tr><td>Comments field</td><td>Yes</td></tr>
<tr><td>Compare field</td><td>Yes</td></tr>
<tr><td>CreateDate field</td><td>No</td></tr>
<tr><td>CreateDate field</td><td>Yes</td></tr>
<tr><td>Date field</td><td>Yes</td></tr>
<tr><td>DocProperty field</td><td>Yes</td></tr>
<tr><td>DocVariable field</td><td>Yes</td></tr>
Expand Down Expand Up @@ -1212,7 +1212,6 @@ Yes<br/><br/></td></tr>
<tr><td>UserAddress field</td><td>No</td></tr>
<tr><td>UserInitials field</td><td>No</td></tr>
<tr><td>UserName field</td><td>No</td></tr>
<tr><td>CreateDate field</td><td>Yes</td></tr>
</table>


Expand Down
26 changes: 25 additions & 1 deletion Document-Processing/Word/Word-Library/NET/Working-with-Ink.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ An Ink annotation is a freehand drawing or handwritten input composed of stroke

N> DocIO supports Ink only in DOCX format documents.

You can insert Ink elements in the document by using the drawing tools available under the **Draw** tab in Word.
![Process](Ink_images/Ink-tab.png)

## Create Ink

The following code example illustrating how to create an Ink in a Word document.
Expand Down Expand Up @@ -122,6 +125,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate a a document with **Ink elements** as shown below.
![Process](Ink_images/Create-Ink.png)

## Create Ink with Multiple Traces

The following code example illustrating how to create an Ink with Multiple Traces (strokes) in a Word document.
Expand Down Expand Up @@ -241,6 +247,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate an **Ink with multiple trace points** as shown below.
![Process](Ink_images/Ink-multipletraces.png)

The following code example shows GetPoints method which is used to get trace points.

{% tabs %}
Expand Down Expand Up @@ -427,6 +436,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate a **Modified ink effect** as shown below.
![Process](Ink_images/Modify-ink-effect.png)

### Modify Ink Color

The following code example demonstrates how to customize the Ink Color.
Expand Down Expand Up @@ -494,6 +506,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate a **Modified ink color** as shown below.
![Process](Ink_images/Modify-ink-color.png)

### Modify Ink Thickness

The following code example demonstrates how to customize the Ink thickness.
Expand Down Expand Up @@ -561,6 +576,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate a **Modified ink thickness** as shown below.
![Process](Ink_images/Modify-ink-thickness.png)

### Modify Ink Points

The following code example demonstrates how to customize the Ink Points.
Expand Down Expand Up @@ -628,6 +646,9 @@ document.Close()

{% endtabs %}

By running the above code, you will generate **modified ink points** as shown below.
![Process](Ink_images/Modify-ink-points.png)

## Remove Ink

You can remove ink by iterating through Ink objects or specifying an index. The following code example demonstrates how to remove the Ink.
Expand Down Expand Up @@ -706,6 +727,9 @@ document.Close()
{% endhighlight %}

{% endtabs %}

By running the above code, you will generate a **Remove Ink** as shown below.
![Process](Ink_images/Remove-ink.png)

## Limitations

Expand All @@ -725,7 +749,7 @@ DocIO supports Ink elements only in DOCX format. However, documents created in W

During Word-to-PDF and Word-to-Image conversions, Syncfusion Word Library uses fallback images embedded in the document to preserve the Ink visual appearance. However, when Ink is created or modified using the Syncfusion Word Library, some Ink effects cannot be rendered accurately due to rendering engine limitations. Although the Ink stroke geometry is preserved, visual brush effects are lost.

**To resolve this**, save the document using DocIO first. Then, open the saved document in Microsoft Word and save it again. Finally, convert it to PDF or Image using DocIO. This process regenerates the required Ink fallback images, ensuring accurate visual output.
**To resolve this**, save the created or modified document using DocIO first in DOCX format. Then, open the saved document in Microsoft Word and save it again. Finally, convert it to PDF or Image using DocIO. This process regenerates the required Ink fallback images, ensuring accurate visual output.

## Frequently Asked Questions

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -882,11 +882,11 @@ For more details, refer [Working with styles](https://help.syncfusion.com/docume

## Example: Triangle Ink Trace Points

### Ink size used:
**Ink size used:**
* Width = 400
* Height = 300

### Triangle points:
**Triangle points:**
* Bottom-left + (0, 300)
* Top-middle + (200, 0)
* Bottom-right + (400, 300)
Expand Down