PdfResources extends PdfObjectWrapper<PdfDictionary> { public Set<PdfName> getResourceNames() { Set<PdfName> names = new TreeSet<>(); for (PdfName resType : getPdfObject().keySet()) { names.addAll(getResourceNames(resType)); } return names; } PdfResources(PdfDictionary pdfObject);  PdfResources(); PdfName addFont(PdfDocument pdfDocument, PdfFont font); PdfName addImage(PdfImageXObject image); PdfName addImage(PdfStream image); PdfImageXObject getImage(PdfName name); PdfName addForm(PdfFormXObject form); PdfName addForm(PdfStream form); PdfName addForm(PdfFormXObject form, PdfName name); PdfFormXObject getForm(PdfName name); PdfName addExtGState(PdfExtGState extGState); PdfName addExtGState(PdfDictionary extGState); PdfExtGState getPdfExtGState(PdfName name); PdfName addProperties(PdfDictionary properties); PdfObject getProperties(PdfName name); PdfName addColorSpace(PdfColorSpace cs); PdfName addColorSpace(PdfObject colorSpace); PdfColorSpace getColorSpace(PdfName name); PdfName addPattern(PdfPattern pattern); PdfName addPattern(PdfDictionary pattern); PdfPattern getPattern(PdfName name); PdfName addShading(PdfShading shading); PdfName addShading(PdfDictionary shading); PdfShading getShading(PdfName name); @Override PdfObjectWrapper<PdfDictionary> setModified(); void setDefaultGray(PdfColorSpace defaultCs); void setDefaultRgb(PdfColorSpace defaultCs); void setDefaultCmyk(PdfColorSpace defaultCs); PdfName getResourceName(PdfObjectWrapper<T> resource); PdfName getResourceName(PdfObject resource); Set<PdfName> getResourceNames(); PdfArray getProcSet(); void setProcSet(PdfArray array); Set<PdfName> getResourceNames(PdfName resType); PdfDictionary getResource(PdfName resType); PdfObject getResourceObject(PdfName resType, PdfName resName);  }
@Test public void getNonExistentResourcesCategory() { PdfResources resources = new PdfResources(); Set<PdfName> unknownResCategory = resources.getResourceNames(new PdfName("UnknownResCategory")); PdfName randomResName = new PdfName("NonExistentResourceName"); Assert.assertFalse(unknownResCategory.contains(randomResName)); Assert.assertFalse(unknownResCategory.remove(randomResName)); Assert.assertTrue(unknownResCategory.isEmpty()); }