|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.intarsys.pdf.content.CSContent
public class CSContent
Represents the tokenized content of a PDF rendering program which is called a "content stream".
A PDF rendering program is a sequence of operations, each build by a list of operands followed by the operator.
Any visual appearance in a PDF document is build on a content stream. For example a PDPage hosts a content stream (or a list of content streams) to define its appearance.
A content stream has no access to indirect objects, this means object references are not valid operands for operations. Complex objects are used within a content stream via an indirection defined in a resource dictionary.
The CSContent
itself is decoupled from its source of creation, this
means after manipulating the content stream you have to apply it where you
want to (for example adding it to a page).
You can work on the content stream directly, adding and removing operations.
A more elegant way to manipulate this is using a CSCreator
,
providing high level methods for the different content stream operations.
Method Summary | |
---|---|
void |
addMarkedContent(COSName mark,
byte[] content)
Add "content" at the end of the "marked content" portion in the content stream of this. |
void |
addOperation(CSOperation op)
Add another operation to the rendering program. |
void |
addOperation(int index,
CSOperation op)
Add another operation to the rendering program. |
static CSContent |
createFromBytes(byte[] data)
Create CSContent from a byte array containing a PDF content
stream. |
static CSContent |
createFromCos(COSArray streams)
Create CSContent from an array of COSStream , together
defining a PDF content stream. |
static CSContent |
createFromCos(COSStream stream)
Create CSContent from a COSStream containing a PDF
content stream. |
static CSContent |
createNew()
Create a new CSContent . |
COSStream |
createStream()
|
CSOperation |
getLastOperation()
remove last operation from the rendering program. |
CSOperation |
getOperation(int index)
|
CSOperation[] |
getOperations()
|
void |
removeLastOperation()
remove last operation from the rendering program. |
void |
removeOperation(int index)
|
void |
setMarkedContent(COSName mark,
byte[] content)
Set the "marked content" portion in the content stream of this. |
int |
size()
The number of operations in the content stream. |
byte[] |
toByteArray()
Create the byte representation from the list of operations. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public static CSContent createFromBytes(byte[] data)
CSContent
from a byte array containing a PDF content
stream.
data
- The bytes defining the PDF content stream.
CSContent
public static CSContent createFromCos(COSStream stream)
CSContent
from a COSStream
containing a PDF
content stream.
stream
- The stream defining containing the PDF content stream.
CSContent
public static CSContent createFromCos(COSArray streams)
CSContent
from an array of COSStream
, together
defining a PDF content stream.
streams
- An array of COSStream
objects containing each a chunk
of the content stream.
CSContent
.public static CSContent createNew()
CSContent
.
CSContent
.public CSOperation getLastOperation()
public void setMarkedContent(COSName mark, byte[] content)
The portion between the marks is replaced with content
.If
no marks are found, the new content is appended as a marked content
section.
mark
- The type of marked content we searchcontent
- The content we want to use.public void addMarkedContent(COSName mark, byte[] content)
mark
- The type of marked content we searchcontent
- The content we want to use.public void addOperation(CSOperation op)
op
- The new operation to append.public void addOperation(int index, CSOperation op)
op
- The new operation to append.public void removeOperation(int index)
public CSOperation[] getOperations()
public CSOperation getOperation(int index)
public COSStream createStream()
public void removeLastOperation()
public int size()
public byte[] toByteArray()
public String toString()
toString
in class Object
|
intarsys PDF library API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |