Skip to main content

FileSpec

Struct FileSpec 

Source
pub struct FileSpec {
    pub file_system: Option<String>,
    pub filename: Option<String>,
    pub unicode_filename: Option<String>,
    pub dos_filename: Option<String>,
    pub unix_filename: Option<String>,
    pub embedded_file: Option<ObjectId>,
    pub description: Option<String>,
    pub data: Option<Vec<u8>>,
}
Expand description

A parsed PDF file specification dictionary.

Fields§

§file_system: Option<String>

File system name (/FS).

§filename: Option<String>

Platform-independent filename (/F).

§unicode_filename: Option<String>

Unicode filename (/UF).

§dos_filename: Option<String>

DOS filename (/DOS).

§unix_filename: Option<String>

Unix filename (/Unix).

§embedded_file: Option<ObjectId>

Indirect reference to the embedded file stream (from /EF sub-dict /F).

§description: Option<String>

Description of the file (/Desc).

§data: Option<Vec<u8>>

Decoded bytes of the embedded file stream, if available.

Populated during parsing from the /EF /F stream when the ObjectStore can decode it. Corresponds to the buffer returned by FPDFAttachment_GetUnderlyingFile.

Implementations§

Source§

impl FileSpec

Source

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

Returns the best available filename for this attachment.

Prefers the Unicode filename (/UF) over the platform-encoded filename (/F), with further fallbacks to Unix and DOS filenames.

Corresponds to FPDFAttachment_GetName.

Source

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

ADR-019 T2 alias for name().

Corresponds to FPDFAttachment_GetName.

Source

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

👎Deprecated:

use attachment_get_name() — matches upstream FPDFAttachment_GetName

Deprecated — use attachment_get_name().

Corresponds to FPDFAttachment_GetName.

Source

pub fn file_data(&self) -> Option<&[u8]>

Returns the decoded bytes of the embedded file stream, if available.

This is the primary data accessor for the embedded file content. Returns None if no embedded file data is present or if decoding failed during parsing.

Corresponds to FPDFAttachment_GetFile.

Source

pub fn attachment_get_file(&self) -> Option<&[u8]>

ADR-019 T2 alias for file_data().

Corresponds to FPDFAttachment_GetFile.

Source

pub fn get_file(&self) -> Option<&[u8]>

👎Deprecated:

use attachment_get_file() — matches upstream FPDFAttachment_GetFile

Deprecated — use attachment_get_file().

Corresponds to FPDFAttachment_GetFile.

Source

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

Returns the MIME type (Subtype) of the embedded file, if present.

Reads the /Subtype entry from the embedded file stream dictionary. Returns None if no subtype is recorded.

Corresponds to FPDFAttachment_GetSubtype.

Note: FileSpec is parsed from the file specification dictionary; the subtype lives in the embedded file stream (/EF /F stream dict /Subtype). This field is not currently extracted during parsing — None is always returned in this release.

Source

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

👎Deprecated:

use subtype() — there is no public FPDFAttachment_GetSubtype API

Deprecated — use subtype() — no public FPDFAttachment_GetSubtype API.

Source

pub fn underlying_bytes(&self) -> Option<&[u8]>

Returns the raw decoded bytes of the embedded file, if available.

This is populated during document parsing when the embedded file stream can be decoded. Returns None if no embedded file data is present or if decoding failed during parsing.

Corresponds to FPDFAttachment_GetUnderlyingFile.

Source

pub fn get_underlying_bytes(&self) -> Option<&[u8]>

👎Deprecated:

use underlying_bytes() — there is no public FPDFAttachment_GetUnderlyingFile API

Deprecated — use underlying_bytes() — no public FPDF_* API.

Source

pub fn set_filename(&mut self, filename: &str) -> DocResult<()>

Set the filename.

Updates both the PDF-encoded /F filename and the Unicode /UF filename in memory. To persist the change to a PDF file, use EditDocument in rpdfium-edit.

Source

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

👎Deprecated since 0.1.0:

use name() instead

Returns the best available filename, preferring Unicode over platform-specific.

Deprecated: use name() instead (primary) or get_name() (upstream alias).

Trait Implementations§

Source§

impl Clone for FileSpec

Source§

fn clone(&self) -> FileSpec

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 FileSpec

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