Skip to content

Commit 8605add

Browse files
Separated examples for .NET Core and .NET Framework projects
1 parent 2da2ef3 commit 8605add

File tree

86 files changed

+1070
-401
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1070
-401
lines changed

Examples/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# to build image run in PS - `docker build --pull -t conversion:examples .`
2+
# to run tests run in PS - `docker run --rm -it -v ${PWD}:/examples/Results conversion:examples`
3+
4+
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS buid_env
5+
6+
# prepare
7+
WORKDIR /examples
8+
COPY ./*.sln ./
9+
COPY ./GroupDocs.Conversion.Examples.CSharp/ ./GroupDocs.Conversion.Examples.CSharp/
10+
COPY ./GroupDocs.Conversion.Examples.CSharp.Core/ ./GroupDocs.Conversion.Examples.CSharp.Core/
11+
# end prepare
12+
13+
# GroupDocs.Conversion dependency - https://docs.groupdocs.com/display/conversionnet/.NET+Standard+2.0+API+Limitations
14+
RUN dotnet add ./GroupDocs.Conversion.Examples.CSharp.Core/GroupDocs.Conversion.Examples.CSharp.Core.csproj package SkiaSharp.NativeAssets.Linux --framework netcoreapp2.1
15+
# GroupDocs.Conversion dependency
16+
17+
# restore
18+
WORKDIR /examples
19+
RUN dotnet restore ./GroupDocs.Conversion.Examples.CSharp.Core/GroupDocs.Conversion.Examples.CSharp.Core.csproj
20+
# end restore
21+
22+
## build
23+
WORKDIR /examples
24+
RUN dotnet publish ./GroupDocs.Conversion.Examples.CSharp.Core/GroupDocs.Conversion.Examples.CSharp.Core.csproj --no-restore --framework netcoreapp2.1 --configuration Debug -o ./../publish_output
25+
## end build
26+
27+
FROM mcr.microsoft.com/dotnet/core/runtime:2.1
28+
29+
# begin GroupDocs.Conversion dependencies - https://docs.groupdocs.com/display/conversionnet/.NET+Standard+2.0+API+Limitations
30+
RUN apt-get update && \
31+
DEBIAN_FRONTEND=noninteractive apt-get install -y libgdiplus && \
32+
DEBIAN_FRONTEND=noninteractive apt-get install -y libc6-dev
33+
34+
RUN apt-get update && \
35+
DEBIAN_FRONTEND=noninteractive apt-get install -y libfontconfig1
36+
37+
RUN echo "deb http://httpredir.debian.org/debian jessie main contrib" > /etc/apt/sources.list \
38+
&& echo "deb http://security.debian.org/ jessie/updates main contrib" >> /etc/apt/sources.list \
39+
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
40+
&& apt-get update \
41+
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ttf-mscorefonts-installer \
42+
&& apt-get clean \
43+
&& apt-get autoremove -y \
44+
&& rm -rf /var/lib/apt/lists/*
45+
# end GroupDocs.Conversion dependencies
46+
47+
WORKDIR /examples
48+
COPY --from=buid_env /examples/publish_output .
49+
ENTRYPOINT ["dotnet", "GroupDocs.Conversion.Examples.CSharp.Core.dll"]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp2.1</TargetFramework>
6+
</PropertyGroup>
7+
8+
9+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
10+
<DefineConstants>TRACE;NETCOREAPP</DefineConstants>
11+
</PropertyGroup>
12+
13+
<Import Project="..\GroupDocs.Conversion.Examples.CSharp\GroupDocs.Conversion.Examples.CSharp.projitems" Label="Shared" />
14+
15+
<ItemGroup>
16+
<PackageReference Include="AWSSDK.S3" Version="3.3.109" />
17+
<PackageReference Include="GroupDocs.Conversion" Version="19.12.1" />
18+
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
19+
<PackageReference Include="WindowsAzure.Storage" Version="9.3.3" />
20+
</ItemGroup>
21+
22+
</Project>
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
using System;
2+
using System.IO;
3+
using GroupDocs.Conversion.Examples.CSharp.AdvancedUsage;
4+
using GroupDocs.Conversion.Examples.CSharp.BasicUsage;
5+
using GroupDocs.Conversion.Examples.CSharp.QuickStart;
6+
7+
namespace GroupDocs.Conversion.Examples.CSharp
8+
{
9+
internal static class RunExamples
10+
{
11+
static void Main()
12+
{
13+
Console.WriteLine("Open RunExamples.cs. \nIn Main() method uncomment the example that you want to run.");
14+
Console.WriteLine("=====================================================");
15+
16+
//NOTE: Please uncomment the example you want to try out
17+
18+
#region Quick Start
19+
20+
SetLicenseFromFile.Run();
21+
//SetLicenseFromStream.Run();
22+
//SetMeteredLicense.Run();
23+
HelloWorld.Run();
24+
25+
#endregion
26+
27+
#region Basic Usage
28+
29+
GetPossibleConversions.Run();
30+
GetSourceDocumentInfo.Run();
31+
32+
#region Convert document to HTML
33+
34+
ConvertToHtml.Run();
35+
36+
#endregion
37+
38+
#region Convert document to Image
39+
40+
ConvertToJpg.Run();
41+
ConvertToPng.Run();
42+
ConvertToPsd.Run();
43+
44+
#endregion
45+
46+
#region Convert document to PDF
47+
48+
ConvertToPdf.Run();
49+
50+
#endregion
51+
52+
#region Convert document to Presentation
53+
54+
ConvertToPresentation.Run();
55+
56+
#endregion
57+
58+
#region Convert document to Spreadsheet
59+
60+
ConvertToSpreadsheet.Run();
61+
62+
#endregion
63+
64+
#region Convert document to WordProcessing
65+
66+
ConvertToWordProcessing.Run();
67+
68+
#endregion
69+
70+
#endregion
71+
72+
#region Advanced Usage
73+
74+
#region Common rendering options
75+
76+
77+
AddWatermark.Run();
78+
ConvertSpecificPages.Run();
79+
80+
#endregion
81+
82+
#region Loading
83+
84+
LoadPasswordProtectedDocument.Run();
85+
86+
#region Loading documents from different sources
87+
88+
LoadDocumentFromLocalDisk.Run();
89+
LoadDocumentFromStream.Run();
90+
// LoadDocumentFromUrl.Run();
91+
// LoadDocumentFromFtp.Run();
92+
// LoadDocumentFromAmazonS3.Run();
93+
// LoadDocumentFromAzureBlobStorage.Run();
94+
95+
#endregion
96+
97+
#region Load options by document type
98+
99+
#region Cad
100+
101+
ConvertCadAndSpecifyLayouts.Run();
102+
ConvertCadAndSpecifyWidthAndHeight.Run();
103+
104+
#endregion
105+
106+
#region Csv
107+
108+
ConvertCsvByConvertingDateTimeAndNumericData.Run();
109+
ConvertCsvBySpecifyingDelimiter.Run();
110+
ConvertCsvBySpecifyingEncoding.Run();
111+
112+
#endregion
113+
114+
#region Email
115+
116+
ConvertEmailWithAlteringFieldsVisibility.Run();
117+
ConvertEmailWithTimezoneOffset.Run();
118+
119+
#endregion
120+
121+
#region Note
122+
123+
ConvertNoteBySpecifyingFontSubstitution.Run();
124+
125+
#endregion
126+
127+
#region Pdf
128+
129+
ConvertPdfAndFlattenAllFields.Run();
130+
ConvertPdfAndHideAnnotations.Run();
131+
ConvertPdfAndRemoveEmbeddedFiles.Run();
132+
133+
#endregion
134+
135+
#region Presentation
136+
137+
ConvertPresentationByHiddingComments.Run();
138+
ConvertPresentationBySpecifyingFontSubstitution.Run();
139+
ConvertPresentationWithHiddenSlidesIncluded.Run();
140+
141+
#endregion
142+
143+
#region Spreadsheet
144+
145+
ConvertSpreadsheetAndHideComments.Run();
146+
ConvertSpreadsheetByShowingGridLines.Run();
147+
ConvertSpreadsheetBySkippingEmptyRowsAndColumns.Run();
148+
ConvertSpreadsheetBySpecifyingFontsubstitution.Run();
149+
ConvertSpreadsheetBySpecifyingRange.Run();
150+
ConvertSpreadsheetWithHiddenSheetsIncluded.Run();
151+
152+
#endregion
153+
154+
#region WordProcessing
155+
156+
ConvertWordProcessingByHiddingComments.Run();
157+
ConvertWordProcessingByHiddingTrackedChanges.Run();
158+
ConvertWordProcessingBySpecifyingFontSubstitution.Run();
159+
160+
#endregion
161+
162+
#endregion
163+
164+
#endregion
165+
166+
ConvertToHtmlWithAdvancedOptions.Run();
167+
ConvertToImageWithAdvancedOptions.Run();
168+
ConvertToPdfWithAdvancedOptions.Run();
169+
ConvertToPresentationWithAdvancedOptions.Run();
170+
ConvertToSpreadsheetWithAdvancedOptions.Run();
171+
ConvertToWordProcessingWithAdvancedOptions.Run();
172+
173+
ListenConversionStateAndProgress.Run();
174+
175+
#endregion
176+
177+
Console.WriteLine();
178+
Console.WriteLine("All done.");
179+
Console.ReadKey();
180+
}
181+
}
182+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{503C96ED-9EB1-4FBA-84F9-6E80238D6BE9}</ProjectGuid>
9+
<OutputType>Exe</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>GroupDocs.Conversion.Examples.CSharp</RootNamespace>
12+
<AssemblyName>GroupDocs.Conversion.Examples.CSharp</AssemblyName>
13+
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>
15+
</TargetFrameworkProfile>
16+
<FileAlignment>512</FileAlignment>
17+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
18+
<RestorePackages>true</RestorePackages>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
21+
<PlatformTarget>x86</PlatformTarget>
22+
<DebugSymbols>true</DebugSymbols>
23+
<DebugType>full</DebugType>
24+
<Optimize>false</Optimize>
25+
<OutputPath>bin\Debug\</OutputPath>
26+
<DefineConstants>DEBUG;TRACE</DefineConstants>
27+
<ErrorReport>prompt</ErrorReport>
28+
<WarningLevel>4</WarningLevel>
29+
<Prefer32Bit>false</Prefer32Bit>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
32+
<PlatformTarget>x86</PlatformTarget>
33+
<DebugType>pdbonly</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
<Prefer32Bit>false</Prefer32Bit>
40+
</PropertyGroup>
41+
<ItemGroup>
42+
<Reference Include="System" />
43+
<Reference Include="System.Core" />
44+
<Reference Include="System.Drawing" />
45+
<Reference Include="System.Xml.Linq" />
46+
<Reference Include="System.Data.DataSetExtensions" />
47+
<Reference Include="Microsoft.CSharp" />
48+
<Reference Include="System.Data" />
49+
<Reference Include="System.Xml" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<Compile Include="Properties\AssemblyInfo.cs" />
53+
<Compile Include="RunExamples.cs" />
54+
</ItemGroup>
55+
<ItemGroup>
56+
<None Include="app.config" />
57+
</ItemGroup>
58+
<ItemGroup />
59+
<ItemGroup>
60+
<PackageReference Include="AWSSDK.Core">
61+
<Version>3.3.103.33</Version>
62+
</PackageReference>
63+
<PackageReference Include="AWSSDK.S3">
64+
<Version>3.3.104.21</Version>
65+
</PackageReference>
66+
<PackageReference Include="GroupDocs.Conversion">
67+
<Version>19.12.1</Version>
68+
</PackageReference>
69+
<PackageReference Include="StackExchange.Redis">
70+
<Version>2.0.601</Version>
71+
</PackageReference>
72+
<PackageReference Include="WindowsAzure.Storage">
73+
<Version>9.3.3</Version>
74+
</PackageReference>
75+
</ItemGroup>
76+
<Import Project="..\GroupDocs.Conversion.Examples.CSharp\GroupDocs.Conversion.Examples.CSharp.projitems" Label="Shared" />
77+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
78+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
79+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
80+
Other similar extension points exist, see Microsoft.Common.targets.
81+
<Target Name="BeforeBuild">
82+
</Target>
83+
<Target Name="AfterBuild">
84+
</Target>
85+
-->
86+
</Project>

0 commit comments

Comments
 (0)