Java Code Examples for com.lowagie.text.pdf.PdfName#COLLECTIONSUBITEM

The following examples show how to use com.lowagie.text.pdf.PdfName#COLLECTIONSUBITEM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PdfCollectionItem.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Adds a prefix for the Collection item.
 * You can only use this method after you have set the value of the item.
 * @param prefix	a prefix
 */
public void setPrefix(String key, String prefix) {
	PdfName fieldname = new PdfName(key);
	PdfObject o = get(fieldname);
	if (o == null)
		throw new IllegalArgumentException("You must set a value before adding a prefix.");
	PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM);
	dict.put(PdfName.D, o);
	dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE));
	put(fieldname, dict);
}
 
Example 2
Source File: PdfCollectionItem.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Adds a prefix for the Collection item.
 * You can only use this method after you have set the value of the item.
 * @param prefix	a prefix
 */
public void setPrefix(String key, String prefix) {
	PdfName fieldname = new PdfName(key);
	PdfObject o = get(fieldname);
	if (o == null)
		throw new IllegalArgumentException("You must set a value before adding a prefix.");
	PdfDictionary dict = new PdfDictionary(PdfName.COLLECTIONSUBITEM);
	dict.put(PdfName.D, o);
	dict.put(PdfName.P, new PdfString(prefix, PdfObject.TEXT_UNICODE));
	put(fieldname, dict);
}