/** * Adds {@link PdfImageXObject} object to the resources. * * @param image the {@link PdfImageXObject} to add. * @return added image resource name. */ public PdfName addImage(PdfImageXObject image) { return addResource(image, imageNamesGen); }
/** * Adds {@link PdfExtGState} object to the resources. * * @param extGState the {@link PdfExtGState} to add. * @return added graphics state parameter dictionary resource name. */ public PdfName addExtGState(PdfExtGState extGState) { return addResource(extGState, egsNamesGen); }
/** * Adds {@link PdfDictionary} to the resources as properties list. * * @param properties the {@link PdfDictionary} to add. * @return added properties list resources name. */ public PdfName addProperties(PdfDictionary properties) { return addResource(properties, propNamesGen); }
/** * Adds {@link PdfStream} to the resources as image. * * @param image the {@link PdfStream} to add. * @return added image resources name. */ public PdfName addImage(PdfStream image) { return addResource(image, imageNamesGen); }
/** * Adds {@link PdfObject} to the resources as color space. * * @param colorSpace the {@link PdfObject} to add. * @return added color space resources name. */ public PdfName addColorSpace(PdfObject colorSpace) { return addResource(colorSpace, csNamesGen); }
/** * Adds {@link PdfFormXObject} object to the resources. * * @param form the {@link PdfFormXObject} to add. * @return added form resource name. */ public PdfName addForm(PdfFormXObject form) { return addResource(form, formNamesGen); }
/** * Adds {@link PdfStream} to the resources as form. * * @param form the {@link PdfStream} to add. * @return added form resources name. */ public PdfName addForm(PdfStream form) { return addResource(form, formNamesGen); }
/** * Adds {@link PdfColorSpace} object to the resources. * * @param cs the {@link PdfColorSpace} to add. * @return added color space resource name. */ public PdfName addColorSpace(PdfColorSpace cs) { return addResource(cs, csNamesGen); }
/** * Adds {@link PdfDictionary} to the resources as pattern. * * @param pattern the {@link PdfDictionary} to add. * @return added pattern resources name. */ public PdfName addPattern(PdfDictionary pattern) { return addResource(pattern, patternNamesGen); }
/** * Adds {@link PdfDictionary} to the resources as graphics state parameter dictionary. * * @param extGState the {@link PdfDictionary} to add. * @return added graphics state parameter dictionary resources name. */ public PdfName addExtGState(PdfDictionary extGState) { return addResource(extGState, egsNamesGen); }
/** * Adds {@link PdfPattern} object to the resources. * * @param pattern the {@link PdfPattern} to add. * @return added pattern resource name. */ public PdfName addPattern(PdfPattern pattern) { return addResource(pattern, patternNamesGen); }
/** * Adds {@link PdfShading} object to the resources. * * @param shading the {@link PdfShading} to add. * @return added shading resource name. */ public PdfName addShading(PdfShading shading) { return addResource(shading, shadingNamesGen); }
/** * Adds {@link PdfDictionary} to the resources as shading dictionary. * * @param shading the {@link PdfDictionary} to add. * @return added shading dictionary resources name. */ public PdfName addShading(PdfDictionary shading) { return addResource(shading, shadingNamesGen); }
/** * Sets the value of default RGB Color Space (see ISO-320001 Paragraph 8.6.5.6). * * @param defaultCs the color space to set. */ public void setDefaultRgb(PdfColorSpace defaultCs) { addResource(defaultCs.getPdfObject(), PdfName.ColorSpace, PdfName.DefaultRGB); }
/** * Sets the value of default Gray Color Space (see ISO-320001 Paragraph 8.6.5.6). * * @param defaultCs the color space to set. */ public void setDefaultGray(PdfColorSpace defaultCs) { addResource(defaultCs.getPdfObject(), PdfName.ColorSpace, PdfName.DefaultGray); }
/** * Adds font to resources and register PdfFont in the document for further flushing. * * @return added font resource name. */ public PdfName addFont(PdfDocument pdfDocument, PdfFont font) { pdfDocument.addFont(font); return addResource(font, fontNamesGen); }
/** * Sets the value of default CMYK Color Space (see ISO-320001 Paragraph 8.6.5.6). * * @param defaultCs the color space to set. */ public void setDefaultCmyk(PdfColorSpace defaultCs) { addResource(defaultCs.getPdfObject(), PdfName.ColorSpace, PdfName.DefaultCMYK); }
<T extends PdfObject> PdfName addResource(PdfObjectWrapper<T> resource, ResourceNameGenerator nameGen) { return addResource(resource.getPdfObject(), nameGen); }
/** * 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; }
PdfName addResource(PdfObject resource, ResourceNameGenerator nameGen) { PdfName resName = getResourceName(resource); if (resName == null) { resName = nameGen.generate(this); addResource(resource, nameGen.getResourceType(), resName); } return resName; }