Expand description
PDF content operators.
This module provides facilities to read and interpret PDF content streams using high-level types.
use hayro_syntax::object::Number;
use hayro_syntax::content::*;
use hayro_syntax::content::ops::*;
let content_stream = b"1 0 0 -1 0 200 cm
0 1.0 0 rg
0 0 m
200 0 l
200 200 l
0 200 l
h
f";
let mut iter = TypedIter::new(content_stream);
assert!(matches!(iter.next(), Some(TypedInstruction::Transform(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::NonStrokeColorDeviceRgb(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::MoveTo(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::LineTo(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::LineTo(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::LineTo(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::ClosePath(_))));
assert!(matches!(iter.next(), Some(TypedInstruction::FillPathNonZero(_))));Modules§
- ops
- Content stream operators.
Structs§
- Instruction
- An instruction (= operator and its operands) in a content stream.
- Operand
Iterator - An iterator over the operands of an operator.
- Operator
- A content stream operator.
- Stack
- A stack holding the arguments of an operator.
- Typed
Iter - An iterator over PDF content streams that provide access to the instructions in a typed fashion.
- Untyped
Iter - An iterator over operators in the PDF content streams, providing raw access to the instructions.