Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src-tauri/src/commands/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,13 @@ pub async fn edit_pdf_overlays(
groups: Vec<PageGroup>,
document: crate::pdf_engine::edit_overlay::EditDocumentIn,
incomplete_source_paths: Option<Vec<String>>,
flatten_annotations: Option<bool>,
) -> Result<JobResult, AppError> {
let handle = registry.register(&job_id);
let app2 = app.clone();
let jid = job_id.clone();
let incomplete = incomplete_source_paths.unwrap_or_default();
let flatten = flatten_annotations.unwrap_or(false);
let res = tauri::async_runtime::spawn_blocking(move || {
crate::pdf_engine::edit_overlay::edit_pdf_overlays(
&app2,
Expand All @@ -233,6 +235,7 @@ pub async fn edit_pdf_overlays(
&output_path,
&document,
&incomplete,
flatten,
)
})
.await
Expand Down
12 changes: 12 additions & 0 deletions src-tauri/src/commands/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ pub async fn page_pdf(app: tauri::AppHandle, input_path: String, page: u32) -> R
.map_err(|e| AppError::io("Could not read the page.", e))?
}

/// List leftover and session markup annots (paths in, JSON out). Never PDF bytes.
#[tauri::command]
pub async fn list_pdf_annots(
input_path: String,
) -> Result<Vec<crate::pdf_engine::edit_annots::ListedMarkup>, AppError> {
tauri::async_runtime::spawn_blocking(move || {
crate::pdf_engine::edit_annots::list_markup_annots(std::path::Path::new(&input_path))
})
.await
.map_err(|e| AppError::io("Could not list annotations.", e))?
}

/// A PDF's bookmarks/outline (flattened). Empty for files with no outline or
/// files too large to parse safely.
#[tauri::command]
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub fn run() {
commands::render::page_pdf,
commands::render::pdf_outline,
commands::render::list_pdf_links,
commands::render::list_pdf_annots,
commands::render::diff_pages,
commands::render::office_available,
commands::render::office_to_pdf,
Expand Down
Loading
Loading