diff --git a/Cargo.lock b/Cargo.lock index 6f785e3..ea96b29 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4689,6 +4689,7 @@ dependencies = [ "mupdf-sys", "once_cell", "percent-encoding", + "serde", "zerocopy", ] diff --git a/Cargo.toml b/Cargo.toml index 63108ff..862cb8c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ rapidfuzz = "0.5.0" # femtovg = { version = "0.16.0", features = ["wgpu"] } # wgpu = "26.0.1" # mupdf = "0.5.0" -mupdf = { version = "0.6.0", git = "https://github.com/messense/mupdf-rs" } +mupdf = { version = "0.6.0", git = "https://github.com/messense/mupdf-rs", features = ["serde"] } tar = "0.4.44" zstd = "0.13.3" fastrand = "2.3.0" diff --git a/src/core/presentations.rs b/src/core/presentations.rs index d568123..104b2e8 100644 --- a/src/core/presentations.rs +++ b/src/core/presentations.rs @@ -63,7 +63,7 @@ impl From for Presentation { .to_str() .unwrap_or_default() { - "pdf" => Document::open(&value.as_path()).map_or( + "pdf" => Document::open(&value.as_os_str()).map_or( PresKind::Pdf { starting_index: 0, ending_index: 0, @@ -189,7 +189,7 @@ impl ServiceTrait for Presentation { }; let background = Background::try_from(self.path.clone()).into_diagnostic()?; debug!(?background); - let document = Document::open(background.path.as_path()).into_diagnostic()?; + let document = Document::open(background.path.as_os_str()).into_diagnostic()?; debug!(?document); let pages = document.pages().into_diagnostic()?; debug!(?pages); @@ -321,7 +321,7 @@ impl Model { } else { let path = PathBuf::from(presentation.path); - Document::open(path.as_path()).map_or( + Document::open(path.as_os_str()).map_or( PresKind::Generic, |document| { document.page_count().map_or( diff --git a/src/ui/presentation_editor.rs b/src/ui/presentation_editor.rs index f9fe8f4..8f041ab 100644 --- a/src/ui/presentation_editor.rs +++ b/src/ui/presentation_editor.rs @@ -445,7 +445,7 @@ impl PresentationEditor { fn update_entire_presentation(&mut self, presentation: &Presentation) { self.presentation = Some(presentation.clone()); self.title.clone_from(&presentation.title); - self.document = Document::open(&presentation.path.as_path()).ok(); + self.document = Document::open(&presentation.path.as_os_str()).ok(); self.page_count = self.document.as_ref().and_then(|doc| doc.page_count().ok()); warn!("changing presentation"); let pages = if let PresKind::Pdf { @@ -573,7 +573,7 @@ fn get_pages( range: impl RangeBounds, presentation_path: impl AsRef, ) -> Option> { - let document = Document::open(presentation_path.as_ref()).ok()?; + let document = Document::open(presentation_path.as_ref().as_os_str()).ok()?; let pages = document.pages().ok()?; Some( pages