PdfA1Checker extends PdfAChecker { @Override protected void checkCatalogValidEntries(PdfDictionary catalogDict) { if (catalogDict.containsKey(PdfName.AA)) { throw new PdfAConformanceException(PdfAConformanceException.A_CATALOG_DICTIONARY_SHALL_NOT_CONTAIN_AA_ENTRY); } if (catalogDict.containsKey(PdfName.OCProperties)) { throw new PdfAConformanceException(PdfAConformanceException.A_CATALOG_DICTIONARY_SHALL_NOT_CONTAIN_OCPROPERTIES_KEY); } if (catalogDict.containsKey(PdfName.Names)) { if (catalogDict.getAsDictionary(PdfName.Names).containsKey(PdfName.EmbeddedFiles)) { throw new PdfAConformanceException(PdfAConformanceException.A_NAME_DICTIONARY_SHALL_NOT_CONTAIN_THE_EMBEDDED_FILES_KEY); } } } PdfA1Checker(PdfAConformanceLevel conformanceLevel); @Override void checkCanvasStack(char stackOperation); @Override void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces); @Override void checkColor(Color color, PdfDictionary currentColorSpaces, Boolean fill); @Override void checkColor(Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream stream); @Override void checkColorSpace(PdfColorSpace colorSpace, PdfDictionary currentColorSpaces, boolean checkAlternate, Boolean fill); @Override void checkXrefTable(PdfXrefTable xrefTable); @Override void checkExtGState(CanvasGraphicsState extGState); @Override void checkExtGState(CanvasGraphicsState extGState, PdfStream contentStream); @Override void checkRenderingIntent(PdfName intent); @Override void checkFont(PdfFont pdfFont);  }
@Test public void checkCatalogDictionaryWithoutAAEntry() { junitExpectedException.expect(PdfAConformanceException.class); junitExpectedException.expectMessage(PdfAConformanceException.A_CATALOG_DICTIONARY_SHALL_NOT_CONTAIN_AA_ENTRY); PdfDictionary catalog = new PdfDictionary(); catalog.put(PdfName.AA, new PdfDictionary()); pdfA1Checker.checkCatalogValidEntries(catalog); }
@Test public void checkCatalogDictionaryWithoutOCPropertiesEntry() { junitExpectedException.expect(PdfAConformanceException.class); junitExpectedException.expectMessage(PdfAConformanceException.A_CATALOG_DICTIONARY_SHALL_NOT_CONTAIN_OCPROPERTIES_KEY); PdfDictionary catalog = new PdfDictionary(); catalog.put(PdfName.OCProperties, new PdfDictionary()); pdfA1Checker.checkCatalogValidEntries(catalog); }
@Test public void checkCatalogDictionaryWithoutEmbeddedFiles() { junitExpectedException.expect(PdfAConformanceException.class); junitExpectedException.expectMessage(PdfAConformanceException.A_NAME_DICTIONARY_SHALL_NOT_CONTAIN_THE_EMBEDDED_FILES_KEY); PdfDictionary names = new PdfDictionary(); names.put(PdfName.EmbeddedFiles, new PdfDictionary()); PdfDictionary catalog = new PdfDictionary(); catalog.put(PdfName.Names, names); pdfA1Checker.checkCatalogValidEntries(catalog); }
@Test public void checkValidCatalog() { pdfA1Checker.checkCatalogValidEntries(new PdfDictionary()); }