Skip to content

Commit d9bfdd3

Browse files
committed
Preliminary examples update for pre-release GroupDocs.Signature for .NET 22.11
1 parent 9344a03 commit d9bfdd3

10 files changed

Lines changed: 135 additions & 5 deletions

File tree

Examples/GroupDocs.Signature.Examples.CSharp.Core/GroupDocs.Signature.Examples.CSharp.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Import Project="..\GroupDocs.Signature.Examples.CSharp\GroupDocs.Signature.Examples.CSharp.projitems" Label="Shared" />
99

1010
<ItemGroup>
11-
<PackageReference Include="GroupDocs.Signature" Version="22.10.0" />
11+
<PackageReference Include="GroupDocs.Signature" Version="22.11.0-alpha-20221130170247" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1313
</ItemGroup>
1414

Examples/GroupDocs.Signature.Examples.CSharp.Core/RunExamples.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ static void Main(string[] args)
478478
OptionsSerialization.Run();
479479

480480
SignWithOrdering.Run();
481+
482+
#region Logging
483+
ConsoleLogging.Run();
484+
FileLogging.Run();
485+
#endregion
486+
481487
#endregion // Advanced Usage
482488

483489
Console.WriteLine();

Examples/GroupDocs.Signature.Examples.CSharp.Framework/GroupDocs.Signature.Examples.CSharp.Framework.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@
5454
<Reference Include="AWSSDK.S3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
5555
<HintPath>..\packages\AWSSDK.S3.3.3.110.10\lib\net45\AWSSDK.S3.dll</HintPath>
5656
</Reference>
57-
<Reference Include="GroupDocs.Signature, Version=22.10.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
58-
<HintPath>..\packages\GroupDocs.Signature.22.10.0\lib\net40\GroupDocs.Signature.dll</HintPath>
57+
<Reference Include="GroupDocs.Signature, Version=22.11.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
58+
<HintPath>..\packages\GroupDocs.Signature.22.11.0-alpha-20221130170247\lib\net40\GroupDocs.Signature.dll</HintPath>
59+
<Private>True</Private>
5960
</Reference>
6061
<Reference Include="Microsoft.Azure.KeyVault.Core, Version=3.0.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
6162
<HintPath>..\packages\Microsoft.Azure.KeyVault.Core.3.0.4\lib\net461\Microsoft.Azure.KeyVault.Core.dll</HintPath>

Examples/GroupDocs.Signature.Examples.CSharp.Framework/RunExamples.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ static void Main(string[] args)
478478
OptionsSerialization.Run();
479479

480480
SignWithOrdering.Run();
481+
482+
#region Logging
483+
ConsoleLogging.Run();
484+
FileLogging.Run();
485+
#endregion
486+
481487
#endregion // Advanced Usage
482488

483489
Console.WriteLine();

Examples/GroupDocs.Signature.Examples.CSharp.Framework/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<packages>
33
<package id="AWSSDK.Core" version="3.3.104.14" targetFramework="net461" />
44
<package id="AWSSDK.S3" version="3.3.110.10" targetFramework="net461" />
5-
<package id="GroupDocs.Signature" version="22.10.0" targetFramework="net461" />
5+
<package id="GroupDocs.Signature" version="22.11.0-alpha-20221130170247" targetFramework="net461" />
66
<package id="Microsoft.Azure.KeyVault.Core" version="3.0.4" targetFramework="net461" />
77
<package id="Microsoft.Rest.ClientRuntime" version="2.3.21" targetFramework="net461" />
88
<package id="Microsoft.Rest.ClientRuntime.Azure" version="3.3.19" targetFramework="net461" />

Examples/GroupDocs.Signature.Examples.CSharp.Net/GroupDocs.Signature.Examples.CSharp.Net.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Import Project="..\GroupDocs.Signature.Examples.CSharp\GroupDocs.Signature.Examples.CSharp.projitems" Label="Shared" />
99

1010
<ItemGroup>
11-
<PackageReference Include="GroupDocs.Signature" Version="22.10.0" />
11+
<PackageReference Include="GroupDocs.Signature" Version="22.11.0-alpha-20221130170247" />
1212
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
1313
</ItemGroup>
1414

Examples/GroupDocs.Signature.Examples.CSharp.Net/RunExamples.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ static void Main(string[] args)
478478
OptionsSerialization.Run();
479479

480480
SignWithOrdering.Run();
481+
482+
#region Logging
483+
ConsoleLogging.Run();
484+
FileLogging.Run();
485+
#endregion
486+
481487
#endregion // Advanced Usage
482488

483489
Console.WriteLine();
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace GroupDocs.Signature.Examples.CSharp.AdvancedUsage
5+
{
6+
using GroupDocs.Signature;
7+
using GroupDocs.Signature.Domain;
8+
using GroupDocs.Signature.Logging;
9+
using GroupDocs.Signature.Options;
10+
11+
public class ConsoleLogging
12+
{
13+
/// <summary>
14+
/// Sign password-protected document
15+
/// </summary>
16+
public static void Run()
17+
{
18+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
19+
Console.WriteLine("[Example Advanced Usage] # ConsoleLogging : Using Console Loggin\n");
20+
21+
// The path to the documents directory.
22+
string filePath = Constants.SAMPLE_PDF_SIGNED_PWD;
23+
string fileName = Path.GetFileName(filePath);
24+
string outputFilePath = Path.Combine(Constants.OutputPath, "LoadPasswordProtected", fileName);
25+
LoadOptions loadOptions = new LoadOptions()
26+
{
27+
Password = "12345678901"
28+
};
29+
var logger = new ConsoleLogger();
30+
var settings = new SignatureSettings(logger);
31+
try
32+
{
33+
using (Signature signature = new Signature(filePath, loadOptions, settings))
34+
{
35+
QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
36+
{
37+
EncodeType = QrCodeTypes.QR,
38+
Left = 100,
39+
Top = 100
40+
};
41+
42+
// sign document to file
43+
signature.Sign(outputFilePath, options);
44+
}
45+
}
46+
catch
47+
{
48+
// skip the Exception - check the log
49+
}
50+
Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
51+
}
52+
}
53+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
using System;
2+
using System.IO;
3+
4+
namespace GroupDocs.Signature.Examples.CSharp.AdvancedUsage
5+
{
6+
using GroupDocs.Signature;
7+
using GroupDocs.Signature.Domain;
8+
using GroupDocs.Signature.Logging;
9+
using GroupDocs.Signature.Options;
10+
11+
public class FileLogging
12+
{
13+
/// <summary>
14+
/// Sign password-protected document
15+
/// </summary>
16+
public static void Run()
17+
{
18+
Console.WriteLine("\n--------------------------------------------------------------------------------------------------------------------");
19+
Console.WriteLine("[Example Advanced Usage] # FileLogging : Using Console Loggin\n");
20+
21+
// The path to the documents directory.
22+
string filePath = Constants.SAMPLE_PDF_SIGNED_PWD;
23+
string fileName = Path.GetFileName(filePath);
24+
25+
string outputFilePath = Path.Combine(Constants.OutputPath, "LoadPasswordProtected", fileName);
26+
string outputLogFile = Path.Combine(Constants.OutputPath, "Logging", "signature-log.txt");
27+
LoadOptions loadOptions = new LoadOptions()
28+
{
29+
Password = "12345678901" // wrong password
30+
};
31+
var logger = new FileLogger(outputLogFile);
32+
var settings = new SignatureSettings(logger);
33+
try
34+
{
35+
using (Signature signature = new Signature(filePath, loadOptions, settings))
36+
{
37+
QrCodeSignOptions options = new QrCodeSignOptions("JohnSmith")
38+
{
39+
EncodeType = QrCodeTypes.QR,
40+
Left = 100,
41+
Top = 100
42+
};
43+
44+
// sign document to file
45+
signature.Sign(outputFilePath, options);
46+
}
47+
}
48+
catch
49+
{
50+
51+
}
52+
53+
Console.WriteLine("\nSource document signed successfully.\nFile saved at " + outputFilePath);
54+
}
55+
}
56+
}

Examples/GroupDocs.Signature.Examples.CSharp/GroupDocs.Signature.Examples.CSharp.projitems

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Loading\LoadingDocumentsFromDifferentSources\LoadDocumentFromStream.cs" />
4848
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Loading\LoadingDocumentsFromDifferentSources\LoadDocumentFromUrl.cs" />
4949
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Loading\LoadPasswordProtectedDocument.cs" />
50+
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Logging\ConsoleLogging.cs" />
51+
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Logging\FileLogging.cs" />
5052
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Saving\SaveDocumentsWithDifferentOutputTypes\SaveSignedImageWithDifferentOutputFileType.cs" />
5153
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Saving\SaveDocumentsWithDifferentOutputTypes\SaveSignedPdfWithDifferentOutputFileType.cs" />
5254
<Compile Include="$(MSBuildThisFileDirectory)AdvancedUsage\Saving\SaveDocumentsWithDifferentOutputTypes\SaveSignedPresentationWithDifferentOutputFileType.cs" />

0 commit comments

Comments
 (0)