如何在pdfbox中验证PDF / A-1a的所有预检错误

时间:2016-03-07 05:35:33

标签: java pdfbox

我正在使用vaildate PDFA / 1A。我按照此链接中已存在的代码PDFbox Preflight PDF/A-1b check not working properly in java version 1.8

public class test
{
  public static void main(final String[] args) throws Exception
  {
    File pdfa=new File("D:/DMC-B787-A-00-40-07-00A-008B-D.pdf"); // error pdf
    isPDFAdocument(pdfa);
    System.out.println("sucess");
  }

  private static void isPDFAdocument(File pdfa) 
  {
    ValidationResult result = null;

    PreflightParser parser;
    try
    {
      parser = new PreflightParser(pdfa);

      parser.parse(Format.PDF_A1A);
      PreflightDocument documentt = parser.getPreflightDocument();
      result = documentt.getResult();
      System.out.println("result"+result);
      documentt.close();

    }
    catch (SyntaxValidationException e)
    {
      result = e.getResult();

    }
    catch (IOException e)
    {
      e.printStackTrace();
    }
    if (result.isValid())
    {
      System.out.println("The file " + pdfa + " is a valid PDF/A-1a file");
    }
    else
    {
      System.out.println("The file" + pdfa + " is not valid, error(s) :");
      for (ValidationError error : result.getErrorsList())
      {
        System.out.println(error.getErrorCode() + " : " + error.getDetails());
      }
    }

它没有检查下面提到的错误。如果它必须显示异常但仍然是它的vaildate成功。 请建议如何验证以下所有概率预检错误。如何在pdfbox中检查它。

错误

CharSet incomplete for Type 1 font (2 matches on 1 page) - 2
Width information for rendered glyphs is inconsistent (2 matches on 1 page) - 2
Document information
File name: "DMC-B787-A-00-40-07-00A-008B-D.pdf"
Path: "C:\Users\wm751e\Documents\Feb19\Synchronize print\Only WDM\Archived doctypes
latest\EA_TBC2016-02-2115.57.49IPD\EA_TBC2016-02-2115.57.49IPD\00"
PDF version number: "1.4"
File size (KB): 114.2
Title: "Illustrated Parts Data - Service Bulletin/Modification List"
Author: "The Boeing Company (PRINTENGINEWEB_BUILD_1.7.49.5.0.0; s1000d_merged_v6.5.36_4.xsl; JobID:)"
Creator: "AH XSL Formatter V6.0 MR7 for Linux64 : 6.0.8.9416 (2013/02/26 10:36JST)"
Producer: "Antenna House PDF Output Library 6.0.389 (Linux64)"
Created: "2/21/2016 3:56 PM"
Modified: "2/21/2016 3:56 PM"
Trapping: "False"
Number of plates: 4
Names of plates: "(Cyan) (Magenta) (Yellow) (Black) "
Environment
Preflight, 15.0.0 (151)
Acrobat version: 15.60
Operating system: Microsoft Windows 7 Service Pack 1 (Build 7601

0 个答案:

没有答案