PdfAChecker implements Serializable { protected void checkResourcesOfAppearanceStreams(PdfDictionary appearanceStreamsDict) { checkResourcesOfAppearanceStreams(appearanceStreamsDict, new HashSet<PdfObject>()); } protected  PdfAChecker(PdfAConformanceLevel conformanceLevel); void checkDocument(PdfCatalog catalog); void checkSinglePage(PdfPage page); void checkPdfObject(PdfObject obj); PdfAConformanceLevel getConformanceLevel(); boolean isFullCheckMode(); void setFullCheckMode(boolean fullCheckMode); boolean objectIsChecked(PdfObject object); void checkTagStructureElement(PdfObject obj); abstract void checkCanvasStack(char stackOperation); abstract void checkInlineImage(PdfStream inlineImage, PdfDictionary currentColorSpaces); @Deprecated abstract void checkColor(Color color, PdfDictionary currentColorSpaces, Boolean fill); void checkColor(Color color, PdfDictionary currentColorSpaces, Boolean fill, PdfStream contentStream); abstract void checkColorSpace(PdfColorSpace colorSpace, PdfDictionary currentColorSpaces, boolean checkAlternate, Boolean fill); abstract void checkRenderingIntent(PdfName intent); @Deprecated abstract void checkExtGState(CanvasGraphicsState extGState); void checkExtGState(CanvasGraphicsState extGState, PdfStream contentStream); abstract void checkFont(PdfFont pdfFont); void checkFontGlyphs(PdfFont font, PdfStream contentStream); abstract void checkXrefTable(PdfXrefTable xrefTable); static final String ICC_COLOR_SPACE_RGB; static final String ICC_COLOR_SPACE_CMYK; static final String ICC_COLOR_SPACE_GRAY; static final String ICC_DEVICE_CLASS_OUTPUT_PROFILE; static final String ICC_DEVICE_CLASS_MONITOR_PROFILE; static final int maxGsStackDepth; }
@Test public void checkAppearanceStreamsWithCycle() throws IOException { try (ByteArrayOutputStream bos = new ByteArrayOutputStream(); PdfWriter writer = new PdfWriter(bos); PdfDocument document = new PdfDocument(writer)) { PdfDictionary normalAppearance = new PdfDictionary(); normalAppearance.put(PdfName.ON, normalAppearance); normalAppearance.makeIndirect(document); PdfAnnotation annotation = new PdfPopupAnnotation(new Rectangle(0f, 0f)); annotation.setAppearance(PdfName.N, normalAppearance); PdfPage pageToCheck = document.addNewPage(); pageToCheck.addAnnotation(annotation); pdfAChecker.checkResourcesOfAppearanceStreams(annotation.getAppearanceDictionary()); } }