Return-Path: X-Original-To: apmail-pdfbox-commits-archive@www.apache.org Delivered-To: apmail-pdfbox-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2D24FD264 for ; Mon, 24 Sep 2012 20:50:39 +0000 (UTC) Received: (qmail 125 invoked by uid 500); 24 Sep 2012 20:50:39 -0000 Delivered-To: apmail-pdfbox-commits-archive@pdfbox.apache.org Received: (qmail 99973 invoked by uid 500); 24 Sep 2012 20:50:38 -0000 Mailing-List: contact commits-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@pdfbox.apache.org Delivered-To: mailing list commits@pdfbox.apache.org Received: (qmail 99966 invoked by uid 99); 24 Sep 2012 20:50:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2012 20:50:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2012 20:50:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 079CB23889BB; Mon, 24 Sep 2012 20:49:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1389563 - in /pdfbox/site/src/site: site.xml xdoc/index.xml xdoc/userguide/preflight.xml Date: Mon, 24 Sep 2012 20:49:53 -0000 To: commits@pdfbox.apache.org From: leleueri@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120924204954.079CB23889BB@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: leleueri Date: Mon Sep 24 20:49:53 2012 New Revision: 1389563 URL: http://svn.apache.org/viewvc?rev=1389563&view=rev Log: [https://issues.apache.org/jira/browse/PDFBOX-1409] Addition of the Preflight documentation page (first part "How to use Preflight" and second part "Error categories") Added: pdfbox/site/src/site/xdoc/userguide/preflight.xml (with props) Modified: pdfbox/site/src/site/site.xml pdfbox/site/src/site/xdoc/index.xml Modified: pdfbox/site/src/site/site.xml URL: http://svn.apache.org/viewvc/pdfbox/site/src/site/site.xml?rev=1389563&r1=1389562&r2=1389563&view=diff ============================================================================== --- pdfbox/site/src/site/site.xml (original) +++ pdfbox/site/src/site/site.xml Mon Sep 24 20:49:53 2012 @@ -84,6 +84,7 @@ + Modified: pdfbox/site/src/site/xdoc/index.xml URL: http://svn.apache.org/viewvc/pdfbox/site/src/site/xdoc/index.xml?rev=1389563&r1=1389562&r2=1389563&view=diff ============================================================================== --- pdfbox/site/src/site/xdoc/index.xml (original) +++ pdfbox/site/src/site/xdoc/index.xml Mon Sep 24 20:49:53 2012 @@ -53,6 +53,7 @@
  • Create a PDF from a text file
  • Create images from PDF pages
  • Print a PDF
  • +
  • PDF/A validation
  • Added: pdfbox/site/src/site/xdoc/userguide/preflight.xml URL: http://svn.apache.org/viewvc/pdfbox/site/src/site/xdoc/userguide/preflight.xml?rev=1389563&view=auto ============================================================================== --- pdfbox/site/src/site/xdoc/userguide/preflight.xml (added) +++ pdfbox/site/src/site/xdoc/userguide/preflight.xml Mon Sep 24 20:49:53 2012 @@ -0,0 +1,120 @@ + + + + PDFBox - Preflight + + +
    + The Apache Preflight library is a Java tool that implements a parser compliant with the ISO-19005 specification (aka PDF/A-1). + + +

    This small sample shows how to check the compliance of a file with the PDF/A-1b specification.

    + +ValidationResult result = null; + +FileDataSource fd = new FileDataSource(args[0]); +PreflightParser parser = new PreflightParser(fd); +try { + + /* Parse the PDF file with PreflightParser that inherits from the NonSequentialParser. + * Some additional controls are present to check a set of PDF/A requirements. + * (Stream length consistency, EOL after some Keyword...) + */ + parser.parse(); + + /* Once the syntax validation is done, + * the parser can provide a PreflightDocument + * (that inherits from PDDocument) + * This document process the end of PDF/A validation. + */ + PreflightDocument document = parser.getPreflightDocument(); + document.validate(); + + // Get validation result + result = document.getResult(); + document.close(); + +} catch (SyntaxValidationException e) { + /* the parse method can throw a SyntaxValidationException + *if the PDF file can't be parsed. + */ In this case, the exception contains an instance of ValidationResult + result = e.getResult(); +} + +// display validation result +if (result.isValid()) { + System.out.println("The file " + args[0] + " is a valid PDF/A-1b file"); +} else { + System.out.println("The file" + args[0] + " is not valid, error(s) :"); + for (ValidationError error : result.getErrorsList()) { + System.out.println(error.getErrorCode() + " : " + error.getDetails()); + } +} + +
    + +

    If a validation fails, the ValidationResult object contains all causes of the failure.
    + In order to help in the failure understanding, all error codes have the following form X[.Y[.Z]] where :

      +
    • 'X' is the category (ex : Font validation error...)
    • +
    • 'Y' represent a subsection of the category (ex : "Font with Glyph error")
    • +
    • 'Z' represent the cause of the error (ex : "Font with a missing Glyph")
    • +
    + Category ('Y') and cause ('Z') may be missing according to the difficulty to identify the error detail.

    +

    Here after, you can find all Categories (for detailed cause, see constants in the PreglihtConstant interface) :

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    CategoryDescription
    1[.y[.z]] Syntax Error
    2[.y[.z]] Graphic Error
    3[.y[.z]] Font Error
    4[.y[.z]] Transparency Error
    5[.y[.z]] Annotation Error
    6[.y[.z]] Action Error
    7[.y[.z]] Metadata Error
    +
    +
    + +
    Propchange: pdfbox/site/src/site/xdoc/userguide/preflight.xml ------------------------------------------------------------------------------ svn:eol-style = native