Skip to content

Commit bc499b1

Browse files
committed
Examples for GroupDocs.Conversion for .NET 19.10
1 parent abe4832 commit bc499b1

File tree

5 files changed

+85
-1
lines changed

5 files changed

+85
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.IO;
3+
using GroupDocs.Conversion.Options.Convert;
4+
using GroupDocs.Conversion.Options.Load;
5+
6+
namespace GroupDocs.Conversion.Examples.CSharp.AdvancedUsage
7+
{
8+
/// <summary>
9+
/// This example demonstrates how to convert an email document to pdf with advanced options
10+
/// </summary>
11+
internal static class ConvertEmailWithTimezoneOffset
12+
{
13+
public static void Run()
14+
{
15+
string outputFolder = Constants.GetOutputDirectoryPath();
16+
string outputFile = Path.Combine(outputFolder, "converted.pdf");
17+
18+
Contracts.Func<LoadOptions> getLoadOptions = () => new EmailLoadOptions
19+
{
20+
TimeZoneOffset = TimeSpan.FromHours(5)
21+
};
22+
23+
using (Converter converter = new Converter(Constants.SAMPLE_EML, getLoadOptions))
24+
{
25+
PdfConvertOptions options = new PdfConvertOptions();
26+
converter.Convert(outputFile, options);
27+
}
28+
29+
Console.WriteLine("\nEmail document converted successfully. \nCheck output in {0}", outputFolder);
30+
}
31+
}
32+
}

Examples/GroupDocs.Conversion.Examples.CSharp/Constants.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ internal static class Constants
7474
public static string SAMPLE_CSV =>
7575
GetSampleFilePath("sample.csv");
7676

77+
// Email documents
78+
public static string SAMPLE_EML =>
79+
GetSampleFilePath("sample.eml");
80+
7781
// Word Processing documents
7882
public static string SAMPLE_DOCX =>
7983
GetSampleFilePath("sample.docx");

Examples/GroupDocs.Conversion.Examples.CSharp/GroupDocs.Conversion.Examples.CSharp.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<Compile Include="AdvancedUsage\Converting\ConvertToWordProcessingWithAdvancedOptions.cs" />
5959
<Compile Include="AdvancedUsage\Converting\ConvertToPresentationWithAdvancedOptions.cs" />
6060
<Compile Include="AdvancedUsage\Converting\ConvertToPdfWithAdvancedOptions.cs" />
61+
<Compile Include="AdvancedUsage\Loading\LoadOptionsByDocumentType\Email\ConvertEmailWithTimezoneOffset.cs" />
6162
<Compile Include="AdvancedUsage\Loading\LoadOptionsByDocumentType\Txt\ConvertTxtBySpecifyingEncoding.cs" />
6263
<Compile Include="AdvancedUsage\Loading\LoadOptionsByDocumentType\Txt\ConvertTxtByControlingTrailingSpacesBehavior.cs" />
6364
<Compile Include="AdvancedUsage\Loading\LoadOptionsByDocumentType\Txt\ConvertTxtByControlingLeadingSpacesBehavior.cs" />
@@ -122,7 +123,7 @@
122123
<Version>3.3.104.21</Version>
123124
</PackageReference>
124125
<PackageReference Include="GroupDocs.Conversion">
125-
<Version>19.9.0</Version>
126+
<Version>19.10.0</Version>
126127
</PackageReference>
127128
<PackageReference Include="StackExchange.Redis">
128129
<Version>2.0.601</Version>

Examples/GroupDocs.Conversion.Examples.CSharp/RunExamples.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ static void Main()
114114
#region Email
115115

116116
// ConvertEmailWithAlteringFieldsVisibility.Run();
117+
// ConvertEmailWithTimezoneOffset.Run();
117118

118119
#endregion
119120

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
X-Unsent: 1
2+
Message-ID: <8c63ad5748ec4294a63b159522007a60>
3+
Subject: New message created by Aspose.Email for .NET
4+
From: "Sender Name" <from@domain.com>
5+
Date: Sun, 1 Sep 2019 21:00:00 +0000
6+
To: "John Doe" <john.doe@groupdocs.com>
7+
Content-Type: text/html; charset="us-ascii"
8+
Content-Transfer-Encoding: quoted-printable
9+
MIME-Version: 1.0
10+
11+
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=
12+
=3Dutf-8" /><meta http-equiv=3D"Content-Style-Type" content=3D"text/css" />=
13+
<meta name=3D"generator" content=3D"Aspose=2EWords for =2ENET 19=2E6" /><ti=
14+
tle></title></head><body><div><p style=3D"margin-top:0pt; margin-bottom:0pt=
15+
; font-size:12pt"><a name=3D"Bookmark1"><span style=3D"font-family:'Times N=
16+
ew Roman'">Text inside a bookmark 1</span></a></p><h1 style=3D"margin-top:1=
17+
2pt; margin-bottom:3pt; page-break-after:avoid; font-size:16pt"><span style=
18+
=3D"-aw-bookmark-end:Bookmark1"></span><span style=3D"font-family:Arial">Pa=
19+
ge 1 heading!</span></h1><p style=3D"margin-top:0pt; margin-bottom:0pt; fon=
20+
t-size:12pt"><span style=3D"font-family:'Times New Roman'">Sample test text=
21+
- Page 1!</span></p><p style=3D"margin-top:0pt; margin-bottom:0pt; font-si=
22+
ze:12pt"><br style=3D"page-break-before:always; clear:both" /><a name=3D"Bo=
23+
okmark2"><span style=3D"font-family:'Times New Roman'">Text inside a bookma=
24+
rk 2</span></a></p><h1 style=3D"margin-top:12pt; margin-bottom:3pt; page-br=
25+
eak-after:avoid; font-size:16pt"><span style=3D"-aw-bookmark-end:Bookmark2"=
26+
></span><span style=3D"font-family:Arial">Page 2 heading!</span></h1><p sty=
27+
le=3D"margin-top:0pt; margin-bottom:0pt; font-size:12pt"><span style=3D"fon=
28+
t-family:'Times New Roman'">Sample test text - Page 2!</span></p><p style=
29+
=3D"margin-top:0pt; margin-bottom:0pt; font-size:12pt"><br style=3D"page-br=
30+
eak-before:always; clear:both" /><a name=3D"Bookmark3"><span style=3D"font-=
31+
family:'Times New Roman'">Text inside a bookmark 3</span></a></p><h1 style=
32+
=3D"margin-top:12pt; margin-bottom:3pt; page-break-after:avoid; font-size:1=
33+
6pt"><span style=3D"-aw-bookmark-end:Bookmark3"></span><span style=3D"font-=
34+
family:Arial">Page 3 heading!</span></h1><p style=3D"margin-top:0pt; margin=
35+
-bottom:0pt; font-size:12pt"><span style=3D"font-family:'Times New Roman'">=
36+
Sample test text - Page 3!</span></p><p style=3D"margin-top:0pt; margin-bot=
37+
tom:0pt; font-size:12pt"><br style=3D"page-break-before:always; clear:both"=
38+
/><a name=3D"Bookmark4"><span style=3D"font-family:'Times New Roman'">Text=
39+
inside a bookmark 4</span></a></p><h1 style=3D"margin-top:12pt; margin-bot=
40+
tom:3pt; page-break-after:avoid; font-size:16pt"><span style=3D"-aw-bookmar=
41+
k-end:Bookmark4"></span><span style=3D"font-family:Arial">Page 4 heading!</=
42+
span></h1><p style=3D"margin-top:0pt; margin-bottom:0pt; font-size:12pt"><s=
43+
pan style=3D"font-family:'Times New Roman'">Sample test text - Page 4!</spa=
44+
n></p><p style=3D"margin-top:0pt; margin-bottom:0pt; font-size:12pt"><span =
45+
style=3D"font-family:'Times New Roman'; -aw-import:ignore">&#xa0;</span></p=
46+
></div></body></html>

0 commit comments

Comments
 (0)