Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Fallback-symbols-based-on-scripttype/Fallback-symbols-based-on-scripttype.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Fallback_symbols_based_on_scripttype</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Office;

namespace Fallback_symbols_based_on_scripttype
{
internal class Program
{
static void Main(string[] args)
{
//Opens the file as stream.
using FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read);
//Loads an existing Word document file stream.
using WordDocument wordDocument = new WordDocument(inputStream, Syncfusion.DocIO.FormatType.Docx);
//Adds fallback font for basic symbols like bullet characters.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Symbols, "Segoe UI Symbol, Arial Unicode MS, Wingdings");
//Adds fallback font for mathematics symbols.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Mathematics, "Cambria Math, Noto Sans Math, Segoe UI Symbol, Arial Unicode MS");
//Adds fallback font for emojis.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Emoji, "Segoe UI Emoji, Noto Color Emoji, Arial Unicode MS");
//Instantiation of DocIORenderer for Word to image conversion.
using DocIORenderer render = new DocIORenderer();
//Convert the entire Word document to images.
Stream[] imageStreams = wordDocument.RenderAsImages();
int i = 0;
foreach (Stream stream in imageStreams)
{
//Reset the stream position.
stream.Position = 0;
//Save the stream as file.
using FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"../../../Output/Output_" + i + ".jpeg"));
stream.CopyTo(fileStreamOutput);
i++;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Fallback-symbols-based-on-scripttype/Fallback-symbols-based-on-scripttype.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Fallback_symbols_based_on_scripttype</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Syncfusion.DocIO.DLS;
using Syncfusion.DocIORenderer;
using Syncfusion.Pdf;
using Syncfusion.Office;
namespace Fallback_symbols_based_on_scripttype
{
internal class Program
{
static void Main(string[] args)
{
//Opens the file as stream.
using FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read);
//Loads an existing Word document file stream.
using WordDocument wordDocument = new WordDocument(inputStream, Syncfusion.DocIO.FormatType.Docx);
//Adds fallback font for basic symbols like bullet characters.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Symbols, "Segoe UI Symbol, Arial Unicode MS, Wingdings");
//Adds fallback font for mathematics symbols.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Mathematics, "Cambria Math, Noto Sans Math, Segoe UI Symbol, Arial Unicode MS");
//Adds fallback font for emojis.
wordDocument.FontSettings.FallbackFonts.Add(ScriptType.Emoji, "Segoe UI Emoji, Noto Color Emoji, Arial Unicode MS");
//Instantiation of DocIORenderer for Word to PDF conversion.
using DocIORenderer render = new DocIORenderer();
//Converts Word document into PDF document.
using PdfDocument pdfDocument = render.ConvertToPDF(wordDocument);
//Saves the PDF file to file system.
using FileStream outputStream = new FileStream(Path.GetFullPath(@"../../../Output/Output.pdf"), FileMode.OpenOrCreate, FileAccess.ReadWrite);
pdfDocument.Save(outputStream);
}
}
}
Loading