Skip to content

Commit 8d466ff

Browse files
Merge pull request #481 from SyncfusionExamples/988636-Apply-matte-color-API
988636 - Added Matte API samples
2 parents 2e85ecb + 7c8b853 commit 8d466ff

File tree

6 files changed

+82
-1
lines changed

6 files changed

+82
-1
lines changed

Videos/Fields/Fields.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="31.1.22" />
10+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
1111
</ItemGroup>
1212

1313
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36518.9
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apply-Matte-to-Transparent-Images", "Apply-Matte-to-Transparent-Images\Apply-Matte-to-Transparent-Images.csproj", "{40DB3241-BF83-4DDD-9CBF-2E9C35764362}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{40DB3241-BF83-4DDD-9CBF-2E9C35764362}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{40DB3241-BF83-4DDD-9CBF-2E9C35764362}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{40DB3241-BF83-4DDD-9CBF-2E9C35764362}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{40DB3241-BF83-4DDD-9CBF-2E9C35764362}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {2147E089-3AAF-47EB-8F73-472AEE09DE80}
24+
EndGlobalSection
25+
EndGlobal
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Apply_Matte_to_Transparent_Images</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Template.docx">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
using Syncfusion.DocIORenderer;
4+
using Syncfusion.Pdf;
5+
6+
namespace Apply_mattee_to_transparent_images
7+
{
8+
class Program
9+
{
10+
public static void Main(string[] args)
11+
{
12+
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data\Template.docx"), FileMode.Open);
13+
//Loads an existing Word document
14+
WordDocument wordDocument = new WordDocument(fileStream, FormatType.Docx);
15+
//Instantiates DocIORenderer instance for Word to PDF conversion
16+
DocIORenderer renderer = new DocIORenderer();
17+
//Set to true to apply a matte color to transparent images.
18+
renderer.Settings.ApplyMatteToTransparentImages = true;
19+
//Converts Word document into PDF document
20+
PdfDocument pdfDocument = renderer.ConvertToPDF(wordDocument);
21+
//Closes the instance of Word document object
22+
wordDocument.Close();
23+
//Releases the resources occupied by DocIORenderer instance
24+
renderer.Dispose();
25+
//Saves the PDF file
26+
pdfDocument.Save(Path.GetFullPath(@"../../../Output/Result.pdf"));
27+
//Closes the instance of PDF document object
28+
pdfDocument.Close();
29+
}
30+
}
31+
}

0 commit comments

Comments
 (0)