Skip to main content

Action

Enum Action 

Source
pub enum Action {
Show 19 variants GoTo(Destination), Uri(String), Named(String), GoToR { file: String, dest: Destination, new_window: Option<bool>, }, Launch { file: String, }, JavaScript { code: String, }, SubmitForm { url: String, fields: Vec<String>, }, ResetForm { fields: Vec<String>, }, ImportData { file: String, }, Sound, Movie, Rendition, GoToE { file_spec: Option<String>, destination: Option<String>, new_window: Option<bool>, }, Thread { thread_ref: Option<String>, }, Hide { target: Option<String>, hide: bool, }, SetOCGState { state: Vec<String>, }, Trans, GoTo3DView, Unknown(String),
}
Expand description

A PDF action associated with a bookmark, link, or other trigger.

Variants§

§

GoTo(Destination)

Navigate to a destination within the current document.

§

Uri(String)

Open a URI.

§

Named(String)

Execute a named action (e.g., “NextPage”, “PrevPage”).

§

GoToR

Navigate to a destination in a remote document.

Fields

§file: String
§new_window: Option<bool>
§

Launch

Launch an application or open a file.

Fields

§file: String
§

JavaScript

Execute JavaScript code (code not executed, only stored).

Fields

§code: String
§

SubmitForm

Submit form data to a URL.

Fields

§fields: Vec<String>
§

ResetForm

Reset form fields.

Fields

§fields: Vec<String>
§

ImportData

Import data from a file.

Fields

§file: String
§

Sound

Play a sound (detection only).

§

Movie

Play a movie (detection only).

§

Rendition

Rendition action (detection only).

§

GoToE

Navigate to a destination in an embedded file.

Fields

§file_spec: Option<String>
§destination: Option<String>
§new_window: Option<bool>
§

Thread

Navigate to an article thread.

Fields

§thread_ref: Option<String>
§

Hide

Show or hide an annotation.

Fields

§target: Option<String>
§hide: bool
§

SetOCGState

Set optional content group state.

Fields

§state: Vec<String>
§

Trans

Transition action (detection only).

§

GoTo3DView

Navigate to a 3D view (detection only).

§

Unknown(String)

Unrecognized action subtype (kUnknown in PDFium).

The /S name is preserved so callers can inspect it. Corresponds to CPDF_Action::Type::kUnknown in upstream.

Implementations§

Source§

impl Action

Source

pub fn has_fields(&self) -> bool

Returns true if this action has an associated field list.

Only SubmitForm and ResetForm actions can carry field lists.

Source

pub fn all_fields(&self) -> &[String]

Returns the field names associated with this action, if any.

Returns an empty slice for actions that don’t carry field lists.

Corresponds to CPDF_Action::GetAllFields() in PDFium.

Source

pub fn fields(&self) -> &[String]

👎Deprecated since 0.1.0:

use all_fields() instead

Convenience helper — same as all_fields().

Returns the field names associated with this action, if any.

Source

pub fn action_type(&self) -> ActionType

Returns the coarse ActionType classification for this action.

Maps the Action enum variant to the corresponding PDFACTION_* constant from PDFium’s fpdf_doc.h.

Corresponds to FPDFAction_GetType.

Source

pub fn action_get_type(&self) -> ActionType

ADR-019 alias for action_type().

Corresponds to FPDFAction_GetType.

Source

pub fn get_type(&self) -> ActionType

👎Deprecated:

use action_get_type() — matches upstream FPDFAction_GetType

Convenience alias — use action_get_type().

Source

pub fn dest(&self) -> Option<&Destination>

Returns the destination of a GoTo or GoToR action, if any.

Returns None if this action is not a GoTo or GoToR variant.

Corresponds to FPDFAction_GetDest.

Source

pub fn action_get_dest(&self) -> Option<&Destination>

ADR-019 alias for dest().

Corresponds to FPDFAction_GetDest.

Source

pub fn get_dest(&self) -> Option<&Destination>

👎Deprecated:

use action_get_dest() — matches upstream FPDFAction_GetDest

Convenience alias — use action_get_dest().

Source

pub fn file_path(&self) -> Option<&str>

Returns the file path of a Launch or GoToR action.

Returns None if this action is not a Launch or GoToR variant.

Corresponds to FPDFAction_GetFilePath.

Source

pub fn action_get_file_path(&self) -> Option<&str>

ADR-019 alias for file_path().

Corresponds to FPDFAction_GetFilePath.

Source

pub fn get_file_path(&self) -> Option<&str>

👎Deprecated:

use action_get_file_path() — matches upstream FPDFAction_GetFilePath

Convenience alias — use action_get_file_path().

Source

pub fn uri_path(&self) -> Option<&str>

Returns the URI of a Uri action.

Returns None if this action is not a Uri variant.

Corresponds to FPDFAction_GetURIPath.

Source

pub fn action_get_uri_path(&self) -> Option<&str>

ADR-019 alias for uri_path().

Corresponds to FPDFAction_GetURIPath.

Source

pub fn get_uri_path(&self) -> Option<&str>

👎Deprecated:

use action_get_uri_path() — matches upstream FPDFAction_GetURIPath

Convenience alias — use action_get_uri_path().

Source

pub fn get_uri(&self) -> Option<&str>

👎Deprecated:

use action_get_uri_path() — matches upstream FPDFAction_GetURIPath

Non-upstream alias — use action_get_uri_path() or uri_path().

Source

pub fn hide_status(&self) -> Option<bool>

Returns the hide/show state of a Hide action.

Returns None if this action is not a Hide variant.

Corresponds to CPDF_Action::GetHideStatus() in PDFium.

Source

pub fn get_hide_status(&self) -> Option<bool>

ADR-019 alias for hide_status().

Corresponds to CPDF_Action::GetHideStatus() in PDFium.

Source

pub fn named_action(&self) -> Option<&str>

Returns the named action string of a Named action.

Returns None if this action is not a Named variant.

Corresponds to CPDF_Action::GetNamedAction() in PDFium.

Source

pub fn get_named_action(&self) -> Option<&str>

ADR-019 alias for named_action().

Corresponds to CPDF_Action::GetNamedAction() in PDFium.

Source

pub fn flags(&self) -> Option<u32>

Returns the flags of a SubmitForm action.

Returns None if this action is not a SubmitForm variant. The flags control which fields are submitted and the submission format per ISO 32000-1 §12.7.5.2.

Corresponds to CPDF_Action::GetFlags() in PDFium.

Source

pub fn get_flags(&self) -> Option<u32>

ADR-019 alias for flags().

Corresponds to CPDF_Action::GetFlags() in PDFium.

Source

pub fn get_all_fields(&self) -> &[String]

ADR-019 alias for all_fields().

Corresponds to CPDF_Action::GetAllFields() in PDFium.

Source

pub fn maybe_javascript(&self) -> Option<&str>

Returns the JavaScript code of a JavaScript action, if any.

Returns None if this action is not a JavaScript variant.

Corresponds to CPDF_Action::MaybeGetJavaScript() in PDFium.

Source

pub fn maybe_get_javascript(&self) -> Option<&str>

ADR-019 alias for maybe_javascript().

Corresponds to CPDF_Action::MaybeGetJavaScript() in PDFium.

Source

pub fn javascript(&self) -> String

Returns the JavaScript code of a JavaScript action as a String.

Returns an empty string if this action is not a JavaScript variant (matching PDFium’s GetJavaScript() which returns empty for non-JS actions and for an empty JS entry).

Corresponds to CPDF_Action::GetJavaScript() in PDFium.

Source

pub fn get_javascript(&self) -> String

👎Deprecated:

use javascript() — there is no public FPDFAction_GetJavaScript API

Non-upstream alias — use javascript().

Trait Implementations§

Source§

impl Clone for Action

Source§

fn clone(&self) -> Action

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 Action

Source§

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

Formats the value using the given formatter. Read more

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more