/** * Gets the names of all the added resources. * * @return the name of all the added resources. */ public Set<PdfName> getResourceNames() { Set<PdfName> names = new TreeSet<>(); // TODO: isn't it better to use HashSet? Do we really need certain order? for (PdfName resType : getPdfObject().keySet()) { names.addAll(getResourceNames(resType)); } return names; }
/** * Adds the given Form XObject to the current instance of {@link PdfResources}. * * @param form Form XObject. * @param name Preferred name for the given Form XObject. * @return the {@link PdfName} of the newly added resource */ public PdfName addForm(PdfFormXObject form, PdfName name) { if (getResourceNames(PdfName.XObject).contains(name)) { name = addResource(form, formNamesGen); } else { addResource(form.getPdfObject(), PdfName.XObject, name); } return name; }