Content Stream Operators
Content Streams
PDF page content is encoded as a sequence of operators in a content stream. Each
Page provides access to its content operators via the getContents() property.
ContentStreamParser
ContentStreamParser parses the raw content stream bytes into operator objects,
enabling programmatic inspection of page drawing commands.
ContentStreamBuilder
ContentStreamBuilder provides a builder API for constructing new content streams
to be embedded in a Page.
Accessing Page Content
try (Document doc = new Document("input.pdf")) {
Page page = doc.getPages().get(1);
// Access content stream via page resources
byte[] contentBytes = page.getContents().toByteArray();
}Content stream operators follow the PDF specification (ISO 32000-1:2008, §8).
Use ContentStreamParser to iterate over the operators in an existing stream.