pub struct GeneratedAp {
pub stream: Vec<u8>,
pub bbox: Rect,
pub matrix: Affine,
pub resources: Dict,
pub rect_override: Option<Rect>,
pub as_override: Option<Name>,
}Expand description
One generated appearance and the dictionary edits it implies.
use pdfrum_common::Diagnostics;
use pdfrum_doc::ap::generate_appearances;
use pdfrum_object::{Array, Dict, Name, NoResolve, Object};
let square = Dict::from_pairs([
(Name::from("Subtype"), Object::Name(Name::from("Square"))),
(
Name::from("Rect"),
Object::Array(Array::of([0, 0, 100, 50])),
),
]);
let page = Dict::from_pairs([(
Name::from("Annots"),
Object::Array(Array::of([Object::Dict(square)])),
)]);
let mut diags = Diagnostics::default();
let overlay = generate_appearances(&page, &NoResolve, &mut diags);
let generated = overlay.get(0).expect("a square has a generator");
// The matrix these generators produce is always the identity.
assert_eq!(generated.matrix, kurbo::Affine::IDENTITY);Fields§
§stream: Vec<u8>The content-stream bytes.
bbox: RectThe form XObject’s bounding box.
matrix: AffineIts matrix, which these generators always leave as the identity.
resources: DictIts resource dictionary.
rect_override: Option<Rect>A rewritten /Rect, when generation moved one.
as_override: Option<Name>A copied-down /AS, for the /NeedAppearances widget path.
Trait Implementations§
Source§impl Clone for GeneratedAp
impl Clone for GeneratedAp
Source§impl Debug for GeneratedAp
impl Debug for GeneratedAp
Source§impl PartialEq for GeneratedAp
impl PartialEq for GeneratedAp
impl StructuralPartialEq for GeneratedAp
Auto Trait Implementations§
impl Freeze for GeneratedAp
impl RefUnwindSafe for GeneratedAp
impl Send for GeneratedAp
impl Sync for GeneratedAp
impl Unpin for GeneratedAp
impl UnsafeUnpin for GeneratedAp
impl UnwindSafe for GeneratedAp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more