Assurer la conformité PDF/A de vos documents
Java | C# | .NET Core | nuget | C/C++ | COM | Ligne de commande
Le 3-Heights™ PDF Validator sert au contrôle de qualité de documents PDF et des processus qui les produisent. Les documents sont vérifiés quant à leur conformité avec les normes ISO pour PDF et PDF/A.
PDF est un format largement répandu. Par conséquent il est important que l’interopérabilité soit assurée. En particulier dans le cas d’informations importantes pour l’entreprise ou d’informations qui doivent être archivées, il faut vérifier que les documents soient corrects et qu’ils soient lisibles à long terme. Cette tâche précisément est assumée par le Validator, que ce soit pour des documents individuels ou en traitement par lots.
Cette transformation est avantageuse pour le client à plusieurs titres : contrairement aux pages TIFF, il est possible d’effectuer des recherches dans les documents PDF et d’en copier/coller le contenu. De plus, l’index peut être utilisé pour naviguer rapidement dans le document.
Electronic insurance applications were previously transferred as normal PDF documents, resulting in the necessity for a hand-written signature on paper. This process has been simplified with the implementation of the Signature Pad and the change to PDF/A format.
Formats d’entrée
Select a PDF/A compliance level and check whether the input PDF document it is compliant or not. In case it is not compliant, get a detailed description of the compliance violations.
// Create the validator
using (PdfValidator validator = new PdfValidator())
{
// Open input file
if (!validator.Open(inputPath, "", complianceLevel))
throw new Exception(String.Format("Input file {0} cannot be opened. " +
"{1} (ErrorCode: 0x{2:x}).", inputPath, validator.ErrorMessage, validator.ErrorCode));
// Validate document
// If true, the PDF is compliant to the specified compliance level.
// If false, the validation either aborted or the PDF is not compliant to
// the specified compliance level.
if (!validator.Validate())
{
if (validator.ErrorCode == PDFErrorCode.PDF_E_CONFORMANCE)
{
Console.WriteLine("Document {0} is not {1} compliant.", inputPath,
compliance);
// Print compliance violations
PdfError currError = validator.GetFirstError();
while (currError != null)
{
Console.WriteLine("Page: {0}, Object: {1}, {2}", currError.PageNo,
currError.ObjectNo, currError.Message);
currError = validator.GetNextError();
}
}
else
throw new Exception(String.Format("Validation of {0} was aborted. {1} " +
"(ErrorCode: 0x{2:x}).", inputPath, validator.ErrorMessage, validator.ErrorCode));
}
else
Console.WriteLine("Document {0} is {1} compliant.", inputPath, compliance);
// Close input file
validator.Close();
}
// Create the validator
validator = new PdfValidatorAPI();
// Open input file
if (!validator.open(inputPath, "", complianceLevel))
throw new IOException(String.format("Input file %s cannot be opened. %s (ErrorCode: 0x%08x).",
inputPath, validator.getErrorMessage(), validator.getErrorCode()));
// Validate document
// If true, the PDF is compliant to the specified compliance level.
// If false, the validation either aborted or the PDF is not compliant to
// the specified compliance level.
if (!validator.validate())
{
if (validator.getErrorCode() == NativeLibrary.ERRORCODE.PDF_E_CONFORMANCE)
{
System.out.printf("Document %s is not %s compliant.\n", inputPath, compliance);
// Print compliance violations
PdfError currError = validator.getFirstError();
while (currError != null)
{
System.out.printf("Page: %d, Object: %s, %s\n", currError.getPageNo(),
currError.getObjectNo(), currError.getMessage());
currError = validator.getNextError();
}
}
else
throw new IOException(String.format("Validation of %s was aborted. %s (ErrorCode: 0x%08x).",
inputPath, validator.getErrorMessage(), validator.getErrorCode()));
}
else
System.out.printf("Document %s is %s compliant.\n", inputPath, compliance);
// Close input file
validator.close();
// Create the validator
pValidator = PdfValidatorCreateObject();
// Open input file
if (!PdfValidatorOpen(pValidator, szInputPath, _T(""), iCompliance))
{
_tprintf(_T("Input file %s cannot be opened. %s (ErrorCode: 0x%08x).\n"), szInputPath, PdfValidatorGetErrorMessage(pValidator), PdfValidatorGetErrorCode(pValidator));
iReturnValue = 1;
goto cleanup;
}
// Validate document
// If true, the PDF is compliant to the specified compliance level.
// If false, the validation either aborted or the PDF is not compliant to
// the specified compliance level.
if (!PdfValidatorValidate(pValidator))
{
if (PdfValidatorGetErrorCode(pValidator) == PDF_E_CONFORMANCE)
{
_tprintf(_T("Document %s is not %s compliant.\n"), szInputPath, szCompliance);
// Print compliance violations
pCurrError = PdfValidatorGetFirstError(pValidator);
while (pCurrError != NULL)
{
int nBufSize = PdfValidatorErrorGetMessage(pCurrError, NULL, 0);
TCHAR* szErrorBuff = malloc(nBufSize*sizeof(TCHAR));
PdfValidatorErrorGetMessage(pCurrError, szErrorBuff, nBufSize);
_tprintf(_T("Page: %d, Object: %d, %s\n"), PdfValidatorErrorGetPageNo(pCurrError), PdfValidatorErrorGetObjectNo(pCurrError), szErrorBuff);
pCurrError = PdfValidatorGetNextError(pValidator);
free(szErrorBuff);
}
}
else
{
_tprintf(_T("Validation of %s was aborted. %s (ErrorCode: 0x%08x).\n"), szInputPath, PdfValidatorGetErrorMessage(pValidator), PdfValidatorGetErrorCode(pValidator));
}
}
else
{
_tprintf(_T("Document %s is %s compliant.\n"), szInputPath, szCompliance);
}
// Close input file
PdfValidatorClose(pValidator);
If I use validation software from different manufacturers I sometimes get different results. Why can this happen? Does it mean that I can't trust the software? What can I do about it? I hear these and more questions very often and I can understand the user's concerns...