pdf_writer::writers

Struct Action

source
pub struct Action<'a> { /* private fields */ }
Expand description

Writer for an action dictionary.

This struct is created by Annotation::action and many keys of AdditionalActions.

Implementations§

source§

impl<'a> Action<'a>

source

pub fn action_type(&mut self, kind: ActionType) -> &mut Self

Write the /S attribute to set the action type.

source

pub fn destination(&mut self) -> Destination<'_>

Start writing the /D attribute to set the destination of this GoTo-type action.

source

pub fn destination_named(&mut self, name: Name<'_>) -> &mut Self

Write the /D attribute to set the destination of this GoTo-type action to a named destination.

source

pub fn file_spec(&mut self) -> FileSpec<'_>

Start writing the /F attribute, depending on the ActionType, setting:

  • RemoteGoTo: which file to go to
  • Launch: which application to launch
  • SubmitForm: script location of the webserver that processes the submission
  • ImportData: the FDF file from which to import data.
source

pub fn new_window(&mut self, new: bool) -> &mut Self

Write the /NewWindow attribute to set whether this remote GoTo action should open the referenced destination in another window.

source

pub fn uri(&mut self, uri: Str<'_>) -> &mut Self

Write the /URI attribute to set where this link action goes.

source

pub fn is_map(&mut self, map: bool) -> &mut Self

Write the /IsMap attribute to set if the click position of the user’s cursor inside the link rectangle should be appended to the referenced URI as a query parameter.

source

pub fn js_string(&mut self, script: TextStr<'_>) -> &mut Self

Write the /JS attribute to set the script of this action as a text string. Only permissible for JavaScript and Rendition actions.

source

pub fn js_stream(&mut self, script: Ref) -> &mut Self

Write the /JS attribute to set the script of this action as a text stream. The indirect reference shall point to a stream containing valid ECMAScript. The stream must have PdfDocEncoding or be in Unicode, starting with U+FEFF. Only permissible for JavaScript and Rendition actions.

source

pub fn fields(&mut self) -> Fields<'_>

Start writing the /Fields array to set the fields which are include/exclude when submitting a form, resetting a form, or loading an FDF file.

source

pub fn form_flags(&mut self, flags: FormActionFlags) -> &mut Self

Write the /Flags attribute to set the various characteristics of form action.

source

pub fn operation(&mut self, op: RenditionOperation) -> &mut Self

Write the /OP attribute to set the operation to perform when the action is triggered.

source

pub fn annotation(&mut self, id: Ref) -> &mut Self

Write the /AN attribute to provide a reference to the screen annotation for the operation. Required if OP is present.

source

pub fn rendition(&mut self) -> Rendition<'_>

Start writing the /R dictionary. Only permissible for the subtype Rendition.

Methods from Deref<Target = Dict<'a>>§

source

pub fn len(&self) -> i32

The number of written pairs.

source

pub fn is_empty(&self) -> bool

Whether no pairs have been written so far.

source

pub fn insert(&mut self, key: Name<'_>) -> Obj<'_>

Start writing a pair with an arbitrary value.

source

pub fn pair<T: Primitive>(&mut self, key: Name<'_>, value: T) -> &mut Self

Write a pair with a primitive value.

This is a shorthand for dict.insert(key).primitive(value).

source

pub fn pairs<'n, T: Primitive>( &mut self, pairs: impl IntoIterator<Item = (Name<'n>, T)>, ) -> &mut Self

Write a sequence of pairs with primitive values.

Trait Implementations§

source§

impl<'a> Deref for Action<'a>

source§

type Target = Dict<'a>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'a> DerefMut for Action<'a>

source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
source§

impl<'a, 'any> Rewrite<'a> for Action<'any>

source§

type Output = Action<'a>

The writer with the rewritten lifetime.
source§

impl<'a> Writer<'a> for Action<'a>

source§

fn start(obj: Obj<'a>) -> Self

Start writing the object.

Auto Trait Implementations§

§

impl<'a> Freeze for Action<'a>

§

impl<'a> RefUnwindSafe for Action<'a>

§

impl<'a> Send for Action<'a>

§

impl<'a> Sync for Action<'a>

§

impl<'a> Unpin for Action<'a>

§

impl<'a> !UnwindSafe for Action<'a>

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> Finish for T

source§

fn finish(self)

Does nothing but move self, equivalent to drop.
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, 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.