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="Custom-font-registration/Custom-font-registration.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Custom_font_registration</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PresentationRenderer.NET" Version="*" />
</ItemGroup>

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

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Syncfusion.Drawing.Fonts;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;
using Syncfusion.Telemetry;

namespace Custom_font_registration
{
class Program
{
public static void Main(string[] args)
{
FontManager.RegisterFonts(Path.GetFullPath(@"Fonts"));
List<string> registerFont = FontManager.RegisteredFontNames;
PPTXtoImage();
FontManager.ClearRegisteredFonts(true);
}

private static void PPTXtoImage()
{
//Open the existing PowerPoint presentation.
using (IPresentation pptxDoc = Presentation.Open(Path.GetFullPath(@"Data/Template.pptx")))
{
//Initialize PresentationRenderer.
pptxDoc.PresentationRenderer = new PresentationRenderer();
//Convert the PowerPoint presentation as image streams.
Stream[] images = pptxDoc.RenderAsImages(ExportImageFormat.Png);
//Save the image streams to file.
for (int i = 0; i < images.Length; i++)
{
using (Stream stream = images[i])
{
using (FileStream fileStreamOutput = File.Create(Path.GetFullPath(@"Output/PPTXtoImage" + i + ".png")))
{
stream.CopyTo(fileStreamOutput);
}
}
}
}
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Custom-font-registration/Custom-font-registration.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<RootNamespace>Custom_font_registration</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.PresentationRenderer.NET" Version="*" />
</ItemGroup>

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

</Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Syncfusion.Drawing.Fonts;
using Syncfusion.Pdf;
using Syncfusion.Presentation;
using Syncfusion.PresentationRenderer;

namespace Custom_font_registration
{
class Program
{
public static void Main(string[] args)
{
FontManager.RegisterFonts(Path.GetFullPath(@"Fonts"));
List<string> registerFont = FontManager.RegisteredFontNames;
PPTXtoPDF();
FontManager.ClearRegisteredFonts(true);
}

private static void PPTXtoPDF()
{
IPresentation presentation = Presentation.Open(Path.GetFullPath(@"Data/Template.pptx"));
//Converts the PowerPoint Presentation into PDF document
PdfDocument pdfDocument = PresentationToPdfConverter.Convert(presentation);
//Saves the PDF document
pdfDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
//Closes the PDF document
pdfDocument.Close(true);
//Closes the Presentation
presentation.Close();
}

}
}
Loading