Skip to main content

ScreenAnnotation

Struct ScreenAnnotation 

Source
pub struct ScreenAnnotation {
    pub rect: Rect,
    pub rendition: MediaRendition,
    pub title: Option<String>,
    pub flags: AnnotationFlags,
    pub contents: Option<String>,
    pub appearance: Option<Vec<u8>>,
    pub operation: RenditionOperation,
}
Expand description

A screen annotation for modern multimedia.

Per PDF spec Section 12.5.6.18, a screen annotation represents a region on a page where media can be played.

Fields§

§rect: Rect

Bounding rectangle for the media display area

§rendition: MediaRendition

Media rendition

§title: Option<String>

Annotation title

§flags: AnnotationFlags

Annotation flags

§contents: Option<String>

Contents/description

§appearance: Option<Vec<u8>>

Background appearance stream

§operation: RenditionOperation

Rendition operation

Implementations§

Source§

impl ScreenAnnotation

Source

pub fn new(rect: Rect, rendition: MediaRendition) -> Self

Create a new screen annotation.

§Arguments
  • rect - Display area for the media
  • rendition - Media rendition to play
Source

pub fn from_clip(rect: Rect, clip: MediaClip) -> Self

Create a screen annotation from a media clip.

Source

pub fn video(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self

Create a video annotation.

Source

pub fn audio(rect: Rect, filename: impl Into<String>, data: Vec<u8>) -> Self

Create an audio annotation.

Source

pub fn with_title(self, title: impl Into<String>) -> Self

Set the title.

Source

pub fn with_rendition_name(self, name: impl Into<String>) -> Self

Set rendition name.

Source

pub fn with_volume(self, volume: f32) -> Self

Set volume.

Source

pub fn with_repeat(self, count: u32) -> Self

Set repeat count (0 = infinite loop).

Source

pub fn with_auto_play(self, auto: bool) -> Self

Set auto-play.

Source

pub fn with_controls(self, show: bool) -> Self

Set whether to show controls.

Source

pub fn with_window_type(self, wtype: WindowType) -> Self

Set window type.

Source

pub fn with_contents(self, contents: impl Into<String>) -> Self

Set description/contents.

Source

pub fn with_flags(self, flags: AnnotationFlags) -> Self

Set annotation flags.

Source

pub fn with_operation(self, op: RenditionOperation) -> Self

Set rendition operation.

Source

pub fn build(&self, _page_refs: &[ObjectRef]) -> HashMap<String, Object>

Build the annotation dictionary for PDF output.

Note: The Rendition and MediaClip must be written separately.

Source

pub fn rendition(&self) -> &MediaRendition

Get the rendition reference.

Trait Implementations§

Source§

impl Clone for ScreenAnnotation

Source§

fn clone(&self) -> ScreenAnnotation

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ScreenAnnotation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<ScreenAnnotation> for Annotation

Source§

fn from(screen: ScreenAnnotation) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Ungil for T
where T: Send,