PDF/A is an ISO-standardized version of PDF that supports archiving of files for future use. Documents in PDF/A format can be reproduced in exactly the same way regardless of the software used. Due to its advantages in long-term preservation of digital documents, it may sometimes be necessary to convert PDF to PDF/A. In this article, you will learn how to programmatically convert PDF to PDF/A-1A, 2A, 3A, 1B, 2B and 3B compliant PDF using Spire.PDF for .NET.
Install Spire.PDF for .NET
To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.
PM> Install-Package Spire.PDF
Convert PDF to PDF/A
The detailed steps are as follows.
- Specify the input file path and output folder
- Create a PdfStandardsConverter instance and pass in the input file as a parameter.
- Convert the input file to PdfA1A conformance level using PdfStandardsConverter.ToPdfA1A() method.
- Convert the input file to PdfA1B conformance level using PdfStandardsConverter.ToPdfA1B() method.
- Convert the input file to PdfA2A conformance level using PdfStandardsConverter.ToPdfA2A() method.
- Convert the input file to PdfA2B conformance level using PdfStandardsConverter.ToPdfA2B() method.
- Convert the input file to PdfA3A conformance level using PdfStandardsConverter.ToPdfA3A() method.
- Convert the input file to PdfA3B conformance level using PdfStandardsConverter.ToPdfA3B() method.
- C#
- VB.NET
using System; using Spire.Pdf.Conversion; namespace ConvertPdf2Pdfa { class Program { static void Main(string[] args) { //Specify input file path String inputFile = @"C:\Users\Administrator\Desktop\sample.pdf"; //Specify output folder String outputFolder = @"C:\Users\Administrator\Desktop\Output\"; //Create a PdfStandardsConverter instance, passing in the input file as a parameter PdfStandardsConverter converter = new PdfStandardsConverter(inputFile); //Convert to PdfA1A converter.ToPdfA1A(outputFolder + "ToPdfA1A.pdf"); //Convert to PdfA1B converter.ToPdfA1B(outputFolder + "ToPdfA1B.pdf"); //Convert to PdfA2A converter.ToPdfA2A(outputFolder + "ToPdfA2A.pdf"); //Convert to PdfA2B converter.ToPdfA2B(outputFolder + "ToPdfA2B.pdf"); //Convert to PdfA3A converter.ToPdfA3A(outputFolder + "ToPdfA3A.pdf"); //Convert to PdfA3B converter.ToPdfA3B(outputFolder + "ToPdfA3B.pdf"); } } }
Apply for a Temporary License
If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.