Create PDF/A Compatible PDFs
Ensuring a document's long-term archiving and preservation is a breeze when using DynamicPDF Core Suite for .NET to create PDF/A compatible PDFs. The following C# examples show you how.
How to Create PDF/A Compatible PDF
Below are the steps and C# sample code to create PDF/A-1a and PDF/A-3a compatible PDF document using DynamicPDF Core Suite for .NET.
Steps for Creating PDF/A Compatible PDF
- Create a
Documentobject. - Create a
XmpMetadataobject. - Create a
PdfASchemaobject and specify the PDF/A standard (A-1a in this case). - Create a
DublinCoreSchemaobject and assign toXmpMetadata. - Set the properties for
DublinCoreSchema. - Set the
XmpMetadatato theDocumentinstance. - Create a
IccProfileobject. - Create a
OutputIntentobject and specify the parameters along with theIccProfileobject. - Create a
Pageobject and add any page element. - Add the
Pageinstance to theDocumentinstance. - Add the
Documentobject'sDrawmethod to draw and save the PDF document.
Sample Code - C#
Document document = new Document();
document.Title = "PDF/A1 Document";
XmpMetadata xmp = new XmpMetadata();
PdfASchema pdfaschema = new PdfASchema(PdfAStandard.PDF_A_1a_2005);
xmp.AddSchema(pdfaschema);
DublinCoreSchema dc = xmp.DublinCore;
dc.Title.DefaultText = document.Title;
dc.Description.DefaultText = document.Subject;
dc.Creators.Add(document.Author);
dc.Title.AddLang("en-us", "PDF/A1 Document");
document.XmpMetadata = xmp;
IccProfile iccProfile = new IccProfile(@"sRGB_IEC61966-2-1_noBPC.icc");
OutputIntent outputIntents = new OutputIntent("", "IEC 61966-2.1 Default RGB colour space - sRGB 1 ", "http://www.color.org", "sRGB IEC61966-2.1 1", iccProfile);
outputIntents.Version = OutputIntentVersion.PDF_A;
document.OutputIntents.Add(outputIntents);
string text = "PDF/A (Archiving) specifically targets PDF documents that need to be preserved long term.";
OpenTypeFont openTypeFont = new OpenTypeFont("times.ttf");
Label label = new Label(text, 0, 0, 504, 100, openTypeFont, 18, TextAlign.Center, RgbColor.BlueViolet);
Page page = new Page(PageSize.Letter, PageOrientation.Portrait, 54.0f);
page.Elements.Add(label);
document.Pages.Add(page);
document.Draw(@"Output.pdf");
Steps for Creating PDF/A-3a Compatible PDF
- Create a
Documentobject. - Create a
XmpMetadataobject. - Create a
PdfASchema` object and specify the PDF/A standard (A-3a in this case). - Create a
DublinCoreSchemaobject and assign toXmpMetadata. - Set the properties for
DublinCoreSchema. - Set the
XmpMetadatato theDocument. - Create a
IccProfileobject. - Create a
OutputIntentobject and specify the parameters along with theIccProfileobject. - Create a
EmbeddedFileobject pass any file that needs to be embedded. - Create a
Pageobject and add any page element. - Add
Pageto the Document. - Add the
Documentobject'sDrawmethod to draw and save the PDF document.
Sample Code - C#
Document document = new Document();
document.Title = "PDF/A1 Document";
XmpMetadata xmp = new XmpMetadata();
PdfASchema pdfaschema = new PdfASchema(PdfAStandard.PdfA3a);
xmp.AddSchema(pdfaschema);
DublinCoreSchema dc = xmp.DublinCore;
dc.Title.DefaultText = document.Title;
dc.Description.DefaultText = document.Subject;
dc.Creators.Add(document.Author);
dc.Title.AddLang("en-us", "PDF/A1 Document");
document.XmpMetadata = xmp;
// Needs iccprofile file to be embedded.
IccProfile iccProfile = new IccProfile(@"ProfilePath\sRGB_IEC61966-2-1_noBPC.icc");
OutputIntent outputIntents = new OutputIntent("", "IEC 61966-2.1 Default RGB colour space - sRGB 1 ", "http://www.color.org", "sRGB IEC61966-2.1 1", iccProfile);
outputIntents.Version = OutputIntentVersion.PDF_A;
document.OutputIntents.Add(outputIntents);
EmbeddedFile embeddedFile1 = new EmbeddedFile(@"ExcelFilePath\HelloWorldExcel.xls");
embeddedFile1.Relation = EmbeddedFileRelation.Data;
embeddedFile1.MimeType = "application/excel";
document.EmbeddedFiles.Add(embeddedFile1);
EmbeddedFile embeddedFile2 = new EmbeddedFile(@"XMLFilePath\Simple.xml");
embeddedFile2.Relation = EmbeddedFileRelation.Source;
embeddedFile2.MimeType = "application/xml";
document.EmbeddedFiles.Add(embeddedFile2);
string text = "PDF/A (Archiving) specifically targets PDF documents that need to be preserved long term.";
OpenTypeFont openTypeFont = new OpenTypeFont("times.ttf");
openTypeFont.Subset = false;
Label label = new Label(text, 0, 0, 504, 100, openTypeFont, 18, TextAlign.Center, RgbColor.BlueViolet);
Page page = new Page(PageSize.Letter, PageOrientation.Portrait, 54.0f);
page.Elements.Add(label);
document.Pages.Add(page);
document.Draw(@"Output.pdf");
GitHub Project
An example project is available on GitHub (examples.dynamicpdf-core-suite-dotnet-core). Examples are provided in C# and VB.NET. Clone or view the example project at GitHub. This specific example discussed on this page are all contained in following classes on GitHub
- C# - PdfACompatibleExample.cs
- VB.NET - PdfACompatibleExample.vb
Getting Started
Get started easily by installing DynamicPDF Core Suite for .NET through NuGet or manually. Then, refer to the documentation for more information on using and purchasing.
NuGet Package
The easiest way to install DynamicPDF Core Suite is by obtaining the NuGet package using Visual Studio's Package Manager. You can also obtain the NuGet package by downloading it directly. Refer to the installation documentation for more information.
DynamicPDF Core Suite Information
DynamicPDF Core Suite for .NET combines creating, merging, and visual report creation into one powerful product for creating PDF documents. It is ideal for anyone who needs to generate PDF documents or reports or work with existing PDFs in their applications. With a free Evaluation Edition to try and with flexible and royalty-free licensing options, why not start using DynamicPDF Core Suite for .NET today!
More Information on PDF/A
- Refer to the PDF/A documentation topic, or
- Chapter 21, Archiving and PDF/A, in the book DynamicPDF Core Suite for .NET by Example available on GitHub.
Available on Other Platforms
DynamicPDF Core Suite is also available for the Java and COM/ActiveX platforms. Refer to the respective product pages for more details.
- DynamicPDF Generator
- Java - DynamicPDF Generator for Java
- COM/ActiveX - DynamicPDF Generator for COM/ActiveX
- DynamicPDF Merger
- Java - DynamicPDF Merger for Java
- COM/ActiveX - DynamicPDF Merger for COM/ActiveX