Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test-net-framework-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
'Other/StreamIO/',
'Printing/PrintPDF/',
'Printing/PrintPDFGUI/',
'Security/AddDigitalSignature/',
'Security/AddRegexRedaction/',
'Security/Redactions/',
'Text/AddGlyphs/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{C5493EAE-45F6-4502-9D26-5BFEC574729F}</ProjectGuid>
<ProjectGuid>{E2C4287F-5817-49CE-912D-9A9F29DBC0DD}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ChangeLayerConfiguration</RootNamespace>
<AssemblyName>ChangeLayerConfiguration</AssemblyName>
Expand Down
6 changes: 3 additions & 3 deletions DocumentConversion/ZUGFeRDConverter/ZUGFeRDConverter.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{7e090b4f-0db4-4c40-a48a-40c0111019d5}</ProjectGuid>
<ProjectGuid>{7CA392CB-AFD3-4BD8-B3B5-C634A8A51F74}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ZUGFeRDConverter</RootNamespace>
<AssemblyName>ZUGFeRDConverter</AssemblyName>
Expand Down Expand Up @@ -56,4 +56,4 @@
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{a1a2f184-6250-4843-8d6b-3a72776dd27d}</ProjectGuid>
<ProjectGuid>{7B949A55-4748-4B93-A9D7-AE6555648A79}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AddTextToImage</RootNamespace>
<AssemblyName>AddTextToImage</AssemblyName>
Expand Down
147 changes: 76 additions & 71 deletions Samples.sln

Large diffs are not rendered by default.

77 changes: 77 additions & 0 deletions Security/AddDigitalSignature/AddDigitalSignature.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
*
* This sample program demonstrates the use of AddDigitalSignature.
*
* Copyright (c) 2025, Datalogics, Inc. All rights reserved.
*
*/
namespace AddDigitalSignature
{
class AddDigitalSignature
{
static void Main(string[] args)
{
Console.WriteLine("AddDigitalSignature Sample:");

using (new Library())
{
Console.WriteLine("Initialized the library.");

String sInput = Library.ResourceDirectory + "Sample_Input/SixPages.pdf";
String sLogo = Library.ResourceDirectory + "Sample_Input/ducky_alpha.tif";
String sOutput = "DigSig-out.pdf";

if (args.Length > 0)
sInput = args[0];

if (args.Length > 1)
sOutput = args[1];

if (args.Length > 2)
sLogo = args[2];

Console.WriteLine("Input file: " + sInput);
Console.WriteLine("Writing to output: " + sOutput);

using (Document doc = new Document(sInput))
{
using (Datalogics.PDFL.SignDoc sigDoc = new Datalogics.PDFL.SignDoc())
{
// Setup Sign params
sigDoc.FieldID = SignatureFieldID.CreateFieldWithQualifiedName;
sigDoc.FieldName = "Signature_es_:signatureblock";

// Set credential related attributes
sigDoc.DigestCategory = DigestCategory.Sha256;
sigDoc.CredentialDataFormat = CredentialDataFmt.NonPFX;
sigDoc.SetNonPfxSignerCert("Credentials/DER/RSA_certificate.der", 0, CredentialStorageFmt.OnDisk);
sigDoc.SetNonPfxPrivateKey("Credentials/DER/RSA_privKey.der", 0, CredentialStorageFmt.OnDisk);

// Setup the signer information
// (Logo image is optional)
sigDoc.SetSignerInfo(sOutput, 0.5, "John Doe", "Chicago, IL", "Approval", "Datalogics, Inc.",
DisplayTraits.KDisplayAll);

// Set the size and location of the signature box (optional)
// If not set, invisible signature will be placed on first page
sigDoc.SignatureBoxPageNumber = 0;
sigDoc.SignatureBoxRectangle = new Rect(100, 300, 400, 400);

// Setup Save params
sigDoc.OutputPath = sOutput;

// Finally, sign and save the document
sigDoc.AddDigitalSignature(doc);

Console.WriteLine();
}
}
}
}
}
}
62 changes: 62 additions & 0 deletions Security/AddDigitalSignature/AddDigitalSignature.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{AB753937-DF3D-4B06-B475-D3B597D32BC5}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>AddDigitalSignature</RootNamespace>
<AssemblyName>AddDigitalSignature</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
<PlatformTarget>x64</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
<PlatformTarget>x64</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AddDigitalSignature.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Adobe.PDF.Library.LM.NETFramework">
<Version>18.*</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
24 changes: 24 additions & 0 deletions Security/AddDigitalSignature/AddDigitalSignature.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.13.35818.85
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddDigitalSignature", "AddDigitalSignature.csproj", "{3790CE63-DB43-4F16-8226-BDFEFA25BCDD}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3790CE63-DB43-4F16-8226-BDFEFA25BCDD}.Debug|x64.ActiveCfg = Debug|x64
{3790CE63-DB43-4F16-8226-BDFEFA25BCDD}.Debug|x64.Build.0 = Debug|x64
{3790CE63-DB43-4F16-8226-BDFEFA25BCDD}.Release|x64.ActiveCfg = Release|x64
{3790CE63-DB43-4F16-8226-BDFEFA25BCDD}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {08DC1B85-4756-4272-B76A-197A8E79394D}
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions Security/AddDigitalSignature/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>
3 changes: 3 additions & 0 deletions Security/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## ***AddDigitalSignature***
Demonstrates adding a digital signature with a logo to a PDF document.

## ***AddRegexRedaction***
Uses a regular expression to find a specified phrase of text in a PDF document and then redacts that text.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x64</Platform>
<ProjectGuid>{05B2CC4F-FCF5-46B2-89FC-0B5ECCD061DF}</ProjectGuid>
<ProjectGuid>{28F740D7-D28F-458F-A9A4-903CC1310558}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>ExtractTextFromAnnotations</RootNamespace>
<AssemblyName>ExtractTextFromAnnotations</AssemblyName>
Expand Down Expand Up @@ -59,4 +59,4 @@
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
</Project>
Loading