Skip to content
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Convert-PDF-to-PDFA2A-conformance-document/Convert-PDF-to-PDFA2A-conformance-document.csproj" Id="5a06001d-287a-4b5f-a79e-52ad2871bf43" />
</Solution>
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?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)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5A06001D-287A-4B5F-A79E-52AD2871BF43}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Convert_PDF_to_PDFA2A_conformance_document</RootNamespace>
<AssemblyName>Convert-PDF-to-PDFA2A-conformance-document</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</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|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Syncfusion.Compression.Base, Version=32.2462.8.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Compression.Base.32.2.8\lib\net462\Syncfusion.Compression.Base.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Licensing, Version=32.2462.8.0, Culture=neutral, PublicKeyToken=632609b4d040f6b4, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Licensing.32.2.8\lib\net462\Syncfusion.Licensing.dll</HintPath>
</Reference>
<Reference Include="Syncfusion.Pdf.Base, Version=32.2462.8.0, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89, processorArchitecture=MSIL">
<HintPath>..\packages\Syncfusion.Pdf.WinForms.32.2.8\lib\net462\Syncfusion.Pdf.Base.dll</HintPath>
</Reference>
<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="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using Syncfusion.Pdf;
using Syncfusion.Pdf.Parsing;
using System.Collections.Generic;
using System.IO;

namespace Convert_PDF_to_PDFA2A_conformance_document
{
internal class Program
{
static void Main(string[] args)
{

var numPages = 0;
//Set the PDF merge options.
var pdfMergeOptions = new PdfMergeOptions
{
//Enable the Merge Accessibility Tags.
MergeAccessibilityTags = true,
OptimizeResources = true
};
//Create an array to store the PDF document streams.
var streamInArray = new Stream[]
{
File.OpenRead(Path.GetFullPath("Input.pdf")),
File.OpenRead(Path.GetFullPath("Input.pdf"))
};
//Create a list to store the PDF document streams.
var streamInList = new List<MemoryStream>();

foreach (var stream in streamInArray)
{
stream.Position = 0;
//Load the PDF document.
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(stream);
//Set the compression options.
loadedDocument.CompressionOptions = new PdfCompressionOptions()
{
CompressImages = false,
OptimizeFont = false,
OptimizePageContents = false,
RemoveMetadata = true
};
//Save the document into stream.
MemoryStream ms = new MemoryStream();
loadedDocument.Save(ms);
loadedDocument.Close(true);
streamInList.Add(new MemoryStream(ms.ToArray()));
}


using (var intermediatePdfStream = new MemoryStream())
{
//Create a new PDF document with PDF/A-2A conformance level.
using (var pdfDocument = new PdfDocument(PdfConformanceLevel.Pdf_A2A))
{
//Set the AutoTag property to true.
pdfDocument.AutoTag = true;
//Set the PDF version to 1.7.
pdfDocument.FileStructure.Version = PdfVersion.Version1_7;
//Merge the PDF documents into a single PDF document.
PdfDocumentBase.Merge(pdfDocument, pdfMergeOptions, streamInList.ToArray());
numPages = pdfDocument.Pages.Count;
//Save the document into stream.
pdfDocument.Save(Path.GetFullPath("Output/Output.pdf"));
//Close the document.
pdfDocument.Close(true);
}
}


}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Convert-PDF-to-PDFA2A-conformance-document")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Convert-PDF-to-PDFA2A-conformance-document")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5a06001d-287a-4b5f-a79e-52ad2871bf43")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Syncfusion.Compression.Base" version="32.2.8" targetFramework="net472" />
<package id="Syncfusion.Licensing" version="32.2.8" targetFramework="net472" />
<package id="Syncfusion.Pdf.WinForms" version="32.2.8" targetFramework="net472" />
</packages>
Loading