Sicherstellung der PDF/A-Konformität Ihrer Dokumente
Java | C# | .NET Core | nuget | C/C++ | COM | Command Line
Der 3-Heights™ PDF Validator dient der Qualitätssicherung von PDF Dokumenten und Prozessen, welche solche erzeugen. Dokumente werden auf Konformität zu den ISO Normen für PDF und PDF/A geprüft.
PDF ist ein weit verbreitetes Format. Deshalb ist es wichtig, dass die Interoperabilität gewährleistet ist. Insbesondere, wenn geschäftsrelevante oder zu archivierende Informationen enthalten sind, müssen die Dokumente auf ihre Korrektheit und langfristige Lesbarkeit geprüft werden. Genau diese Aufgabe, sei es für einzelne Dokumente oder Stapel, übernimmt der Validator.
Mit der Umstellung profitiert der Kunde von verschiedenen Vorteilen: Im Gegensatz zu TIFF Seiten sind PDF Dokumente durchsuchbar und Text kann durch Copy & Paste weiter verwendet werden. Darüber hinaus ist das Inhaltsverzeichnis nutzbar, um innerhalb des Dokumentes schnell zu navigieren. Mittels Hyperlinks können die Benutzer rasch zu referenzierten Dokumenten springen.
Früher wurden elektronische Versicherungsanträge als herkömmliches PDF Dokument übermittelt, was eine gesonderte eigenhändige Unterschrift auf Papier erforderlich machte. Mit der Einführung des Signatur-Pads und dem Wechsel auf PDF/A wurde dieser Prozess vereinfacht.
Eingangsformate
Im Archiv übernimmt die Komponente die Funktion eines Torwächters: Dokumente, die dem Standard nicht entsprechen, werden abgelehnt. Der Validator lässt sich auch zur Qualitätsprüfung bestehender Archivbestände einsetzen sowie zur Qualitätssicherung bei der Konvertierung von TIFF Archiven nach PDF/A. Die Massenverarbeitung kann mit einer Batchdatei oder einer individuell programmierten Lösung (z.B. in C#, Java oder Visual Basic) erreicht werden.
Wähle eine PDF/A-Konformitätsstufe aus und überprüfe, ob das eingehende PDF Dokument konform ist oder nicht. Falls es nicht konform ist, wird eine detaillierte Beschreibung der Compliance-Verstösse generiert.
// 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...