Validating PDF/A files
This sample shows you how to verify ISO 19005-1 and ISO 19005-2 compliance for existing PDF documents.
C#
using System;
using SolidFramework.Converters.Plumbing;
using SolidFramework.Converters;
namespace ValidatePDFA
{
class Program
{
[STAThread]
static void Main(string[] args)
{
// Call your Solid Documents License
SolidFramework.License.Import(@"C:\MyFolder\license.xml");
// Set the location of your the file you want to convert
String pdfPath = @"C:\YourFolder\yourpdf.pdf";
//*Validate PDF/A File*//
using (PdfToPdfAConverter converter = new PdfToPdfAConverter())
{
// Add files to convert.
converter.AddSourceFile(pdfPath);
// Set the converter to only validate
converter.ValidateOnly = true;
// Call Convert to start the job.
converter.Convert();
// Call the Conversion Result
IConversionResult result = converter.Results[0];
// Check the report
SolidFramework.Pdf.Reports.PdfAReport report = converter.Report;
converter.Report.Save(@"C:\MyReport\pdfa_report.xml");
}
}
}
}
C++
#include "stdafx.h"
#include "SolidFramework.h"
using namespace std;
int main()
{
// Call your Solid Documents License
SolidFramework::License::Import(L"c:\\MyFolder\\license.xml");
// Add the PDF file to convert
wstring pdfPath(L"c:\\yourfolder\\yourpdf.pdf");
//*Validate PDF/A File*//
SolidFramework::Converters::PdfToPdfAConverterBasePtr converter(new SolidFramework::Converters::PdfToPdfAConverterBase());
// Add files to convert.
converter->AddSourceFile(pdfPath);
// Set the converter to only validate
converter->setValidateOnly(true);
// Call Convert to start the job.
converter->Convert();
// Check the report
converter->getReport()->Save(L"C:\\MyReport\\pdfa_report.xml");
converter->Dispose();
return 0;
}
VB.Net
Imports SolidFramework.Converters.Plumbing
Module ValidatePDFA
Sub Main()
' Call your Solid Documents License
SolidFramework.License.Import("C:\MyFolder\license.xml")
'Define a variable for your source file
Dim sPdfPath As String
' Define your Solid Framework Converter
Dim myConverter As SolidFramework.Converters.PdfToPdfAConverter
' Define a Conversion Result
Dim cResult As IConversionResult
' Define a Report
Dim myReport As SolidFramework.Pdf.Reports.PdfAReport
' Set your file path
sPdfPath = "C:\YourFolder\filepdf.pdf"
' Set the converter
myConverter = New SolidFramework.Converters.PdfToPdfAConverter
'Set the preferred conversion properties
' Add files to convert.
myConverter.AddSourceFile(sPdfPath)
' Set the converter to only validate
myConverter.ValidateOnly = True
' Call Convert to start the job.
myConverter.Convert()
'Call the conversion result
' Set and Call the Conversion Result
cResult = New IConversionResult
cResult = myConverter.Results(0)
' Set and check the Report
myReport = myConverter.Report
myConverter.Report.Save("C:\MyReport\pdfa_report.xml")
' Clean up
myConverter.Dispose()
End Sub
End Module
