Skip to content

Commit 1ade30f

Browse files
Merge pull request #98 from Suriya-Balamurugan/master
Add .NET sample to set PDF conformance level
2 parents fd4103a + 1879813 commit 1ade30f

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed
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.4.33110.190
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set-PDF-conformance-level", "Set-PDF-conformance-level\Set-PDF-conformance-level.csproj", "{200E55BD-87C8-4D42-A14E-290C0AB1EF00}"
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+
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{200E55BD-87C8-4D42-A14E-290C0AB1EF00}.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 = {5944F990-AC83-4E81-AEB9-28E7F2EE876D}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Syncfusion.Pdf;
2+
using Syncfusion.Presentation;
3+
using Syncfusion.PresentationRenderer;
4+
5+
//Create a file stream to read the PowerPoint presentation file.
6+
using FileStream inputStream = new(Path.GetFullPath(@"Data/Template.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
7+
//Open an existing PowerPoint presentation.
8+
using IPresentation pptxDoc = Presentation.Open(inputStream);
9+
//Initialize the conversion settings.
10+
PresentationToPdfConverterSettings pdfConverterSettings = new PresentationToPdfConverterSettings();
11+
//Set the Pdf conformance level to A1B
12+
pdfConverterSettings.PdfConformanceLevel = PdfConformanceLevel.Pdf_A1B;
13+
//Convert the PowerPoint presentation to PDF file.
14+
using PdfDocument pdfDocument = PresentationToPdfConverter.Convert(pptxDoc, pdfConverterSettings);
15+
//Create new instance of file stream.
16+
using FileStream pdfStream = new(Path.GetFullPath(@"Output/PPTXToPDF.pdf"), FileMode.Create);
17+
//Save the generated PDF to file stream.
18+
pdfDocument.Save(pdfStream);
Lines changed: 24 additions & 0 deletions
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>Set_PDF_conformance_level</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.PresentationRenderer.NET" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<None Update="Data\Template.pptx">
17+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
18+
</None>
19+
<None Update="Output\.gitkeep">
20+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
21+
</None>
22+
</ItemGroup>
23+
24+
</Project>

0 commit comments

Comments
 (0)