public class Content
extends java.lang.Object
The index associated with Content is 0-based, so 0 is the first element.
| Modifier and Type | Field and Description |
|---|---|
static int |
BEFORE_FIRST
Position for inserting an element before the first element.
|
| Constructor and Description |
|---|
Content()
Create content
|
Content(Element firstElem)
Create content with a first Element.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addElement(Element NewElem)
Adds an existing Element at the end of the content object.
|
void |
addElement(Element NewElem,
int addAfterIndex)
Adds an existing Element at the given index of the content object.
|
void |
addPage(int insertAfterIndex,
Document containerDoc,
Page srcPage,
Matrix dstMatrix,
java.util.List<java.lang.String> annotTypes,
java.util.EnumSet<AddPageFlags> flags,
Rect bbox)
Adds the specfied Page to the Content as a Form.
|
void |
delete() |
boolean |
flattenOptionalContent(OptionalContentContext occ)
Flattens optional content within this Content object.
|
Rect |
getBoundingBox()
The bounding box for this content.
|
ColorSpace |
getDefaultColorSpace(java.lang.String name)
Get a default color space from a Content object.
|
Element |
getElement(int index)
Get the element specified by index.
|
int |
getNumElements()
The number of elements in the Content object.
|
void |
removeElement(int index)
Removes the Element at the specified index.
|
void |
setDefaultColorSpace(java.lang.String name,
ColorSpace colorSpace)
Set a default color space from a Content object.
|
java.lang.String |
toString() |
public static final int BEFORE_FIRST
public Content()
public Content(Element firstElem)
firstElem - The Element which is to be added to the beginning of the new Content object.public void delete()
public java.lang.String toString()
toString in class java.lang.Objectpublic int getNumElements()
public Element getElement(int index)
public void addElement(Element NewElem)
NewElem - The Element which is to be added to the end of the existing Content object.public void addElement(Element NewElem, int addAfterIndex)
NewElem - The Element which is to be added to the end of the existing Content object.addAfterIndex - The position after which to insert the new Element, the index is 0-based so 0 is the first element. To insert a new element as the first element use the Content.BeforeFirst constant.public void addPage(int insertAfterIndex,
Document containerDoc,
Page srcPage,
Matrix dstMatrix,
java.util.List<java.lang.String> annotTypes,
java.util.EnumSet<AddPageFlags> flags,
Rect bbox)
insertAfterIndex - The index indicates the location after which the specified element is to be added. The index should be BeforeFirst to add to the beginning of the display list.containerDoc - The Document in which the page is contained.srcPage - The page that will be inserted at insertAfterIndex in theContent.dstMatrix - (May be NULL) The matrix applied to the default matrix of the Page that is inserted into the Document.annotTypes - If the page contains annotations, the annotTypes list is used to determine which annotation types are pumped into the page contents of the CosDoc.flags - (May be 0) AllAnnotations specifies all annotation types. If this is not set, then the annotTypes list will be consulted.bbox - (May be NULL) specifies the destination BBox for the page being inserted. If it is NULL, the new page's media box is used.public void removeElement(int index)
index - The position at which to remove the Elementpublic Rect getBoundingBox()
The bounding box is a rectangle that is at least large enough to contain the bounding boxes for all the elements in the Content.
public ColorSpace getDefaultColorSpace(java.lang.String name)
name - The name of the color space to get. It must be one of DefaultRGB, DefaultCMYK, or DefaultGray.public void setDefaultColorSpace(java.lang.String name,
ColorSpace colorSpace)
name - The name of the color space to set. It must be one of DefaultRGB, DefaultCMYK, or DefaultGray.colorSpace - The color space to set. It may not be a Lab, Indexed or Pattern color space.public boolean flattenOptionalContent(OptionalContentContext occ)
Removes elements that are not visible in the given optional content context and removes optional content information from any visible elements.
The optional content information formerly associated with this Content object will NOT be deleted from the document, as it is possible that content elsewhere in the document may be using the information.
occ - The optional content context in which content is checked for visibility.