use crate::{
destination::Destination, error::PdfResult, file_specification::FileSpecification,
objects::Dictionary, Resolve,
};
#[derive(Debug)]
pub struct GoToAction {
d: Destination,
}
impl GoToAction {
pub fn from_dict(mut dict: Dictionary, resolver: &mut impl Resolve) -> PdfResult<Self> {
let d = Destination::from_obj(dict.expect_object("D", resolver)?, resolver)?;
Ok(Self { d })
}
}
#[derive(Debug)]
pub struct GoToRemoteAction {
f: FileSpecification,
d: Destination,
new_window: Option<bool>,
}
impl GoToRemoteAction {
pub fn from_dict(mut dict: Dictionary, resolver: &mut impl Resolve) -> PdfResult<Self> {
let f = FileSpecification::from_obj(dict.expect_object("F", resolver)?, resolver)?;
let d = Destination::from_obj(dict.expect_object("D", resolver)?, resolver)?;
let new_window = dict.get_bool("NewWindow", resolver)?;
Ok(Self { f, d, new_window })
}
}