This .NET console application converts one or more PDF files to PDF/A and validates the resulting documents for PDF/A conformance.
This project uses:
- Docotic.Pdf library for PDF-to-PDF/A conversion
- veraPDF for PDF/A validation
- Install .NET 10 to run this application.
- Install the JDK required to run veraPDF.
- Install veraPDF if you are using Linux or macOS. For Windows, a version of veraPDF is already included in the veraPDF directory of this repository.
- Get a Docotic.Pdf license key at https://bitmiracle.com/pdf-library/download
When you run the application without command-line arguments, it starts in UI mode. You will be prompted to enter the following options:
- The target PDF/A conformance level. Supported conformance levels are PDF/A-1a, PDF/A-1b, PDF/A-2a, PDF/A-2b, PDF/A-2u, PDF/A-3a, PDF/A-3b, PDF/A-3u, PDF/A-4, PDF/A-4e, and PDF/A-4f.
- An input PDF file or a directory containing PDF files. This repository includes test files from Isartor Test Suite and veraPDF Corpus in TestFiles.
- Docotic.Pdf license key.
- The path to the veraPDF CLI, if the application cannot locate it automatically.
You can also specify any of these options in advance using command-line arguments. The application stores the last used Docotic.Pdf license key, so you don't need to enter it every time.
The application creates a temporary output directory and stores the converted PDF/A files there. It then validates the converted files with veraPDF and prints the results. After validation, you can review the veraPDF report and choose whether to delete the output directory.
Sample output:
Target conformance level: PDF/A-1b
Input PDF(s): C:\Work\PdfToPdfa\TestFiles\veraPDF Corpus\PDF_A-1b
veraPDF located at: C:\Work\PdfToPdfa\veraPDF\verapdf.bat
Converted 306 PDF files to PDF/A-1b
Succeeded: 306 files
Failed: 0 files
Output directory: C:\Users\shibaev\AppData\Local\Temp\omghu2uo.dxi
Elapsed: 3.9624913 sec.
Validated 306 PDF/A-1b files
Compliant: 306 files
Non-compliant: 0 files
Report: C:\Users\shibaev\AppData\Local\Temp\omghu2uo.dxi\verapdf-report.xml
Elapsed: 3.224273 sec.
The application can also run in script mode without user interaction. In script mode, you must provide all command-line arguments:
-i, --input Path to the input PDF file or directory
-c, --conformance The target PDF/A conformance level. Possible values: 1a, 1b, 2a, 2b, 2u, 3a, 3b, 3u, 4, 4e, 4f
-k, --key Docotic.Pdf license key
-v, --verapdf The path to the veraPDF CLI
-d, --delete-output Delete the output directory after processing
You can also use -h or --help to display the same information in the console.