C#/VB.NET Convert PDF to PDF/A

 

PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for use in the archiving and long-term preservation of electronic documents. PDF/A differs from PDF by prohibiting features unsuitable for long-term archiving, such as font linking (as opposed to font embedding) and encryption.[1] The ISO requirements for PDF/A file viewers include color management guidelines, support for embedded fonts, and a user interface for reading embedded annotations. In this article, I will show you how to programmatically convert PDF to PDF/A. Read on for more information.

 

Programming Environment 

In this test, Free Spire.PDF for .NET is introduced into the program. The Spire.PDF.dll file can be referenced by:

 

Method 1: Download Free Spire.PDF for .NET locally, unzip it, and install it. After the installation is complete, find Spire.PDF.dll in the BIN folder under the installation path. Then open the "Solution Explorer" in Visual Studio, right-click "References", "Add Reference", and add a reference to the dll file in the BIN folder of the local path to the program.

 

Method 2: Install via NuGet. It can be installed by the following 2 methods:

 

(1) You can open the "Solution Explorer" in Visual Studio, right-click "References", "Manage NuGet Packages", then search for "Free Spire.PDF", and click "Install". Wait for the program installation to complete.

 

(2) Copy the following content to the PM console installation.

 

Install-Package FreeSpire.PDF -Version 8.6.0

Convert PDF to PDF/A

l  Specify the input file path and output folder

l  Create a PdfStandardsConverter instance and pass in the input file as a parameter.

l  Convert the input file to PdfA1A conformance level using PdfStandardsConverter.ToPdfA1A() method.

l  Convert the input file to PdfA1B conformance level using PdfStandardsConverter.ToPdfA1B() method.

l  Convert the input file to PdfA2A conformance level using PdfStandardsConverter.ToPdfA2A() method.

l  Convert the input file to PdfA2B conformance level using PdfStandardsConverter.ToPdfA2B() method.

l  Convert the input file to PdfA3A conformance level using PdfStandardsConverter.ToPdfA3A() method.

l  Convert the input file to PdfA3B conformance level using PdfStandardsConverter.ToPdfA3B() method.

Full Code

C#
Imports Spire.Pdf.Conversion

Namespace ConvertPdf2Pdfa
    Friend Class Program
        Private Shared Sub Main(ByVal args As String())
            'Specify input file path
            Dim inputFile = "Yellowstone National Park.pdf"

            'Specify output folder
            Dim outputFolder = "C:\Users\Tina\Desktop\Output\"

            'Create a PdfStandardsConverter instance, passing in the input file as a parameter
            Dim converter As PdfStandardsConverter = 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")
        End Sub
    End Class
End Namespace

VB.NET
Imports Spire.Pdf.Conversion

Namespace ConvertPdf2Pdfa
    Friend Class Program
        Private Shared Sub Main(ByVal args As String())
            'Specify input file path
            Dim inputFile = "Yellowstone National Park.pdf"

            'Specify output folder
            Dim outputFolder = "C:\Users\Tina\Desktop\Output\"

            'Create a PdfStandardsConverter instance, passing in the input file as a parameter
            Dim converter As PdfStandardsConverter = 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")
        End Sub
    End Class
End Namespace

Effective Shot


Conclusion:

In this article, you have learned how to Convert PDF to PDF/A in C#/VB.NET. Not only that, we also have other functions, such as, C#/VB.NET: Convert Text Files to PDF, C#/VB.NET: Convert PDF to HTML, C#/VB.NET: Convert PDF to Word and so on. Apart from that, if you'd like to learn more, you can visit this link to explore more about for Spire.PDF for .NET.


Comments

Popular posts from this blog

How to Convert OpenDocument Presentation (.odp) to PDF via Java Application

Java: How to encrypt or decrypt PDF documents?

How to Change Font Color in Word via Java