Skip to content

Commit

Permalink
use lopdf error instead of adding custom one
Browse files Browse the repository at this point in the history
  • Loading branch information
linusbierhoff committed Jul 31, 2024
1 parent d7dae5f commit c56efd3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ pub enum OutputError
FormatError(std::fmt::Error),
IoError(std::io::Error),
PdfError(lopdf::Error),
PageNotFound,
}

impl std::fmt::Display for OutputError
Expand All @@ -49,7 +48,6 @@ impl std::fmt::Display for OutputError
OutputError::FormatError(e) => write!(f, "Formating error: {}", e),
OutputError::IoError(e) => write!(f, "IO error: {}", e),
OutputError::PdfError(e) => write!(f, "PDF error: {}", e),
OutputError::PageNotFound => write!(f, "Page not found:")
}
}
}
Expand Down Expand Up @@ -2307,7 +2305,7 @@ pub fn output_doc_page(doc: &Document, output: &mut dyn OutputDev, page_num: u32
}
let empty_resources = Dictionary::new();
let pages = doc.get_pages();
let object_id = pages.get(&page_num).ok_or(OutputError::PageNotFound)?;
let object_id = pages.get(&page_num).ok_or(lopdf::Error::PageNumberNotFound(page_num))?;

let mut p = Processor::new();
output_doc_inner(page_num, *object_id, doc, &mut p, output, &empty_resources)?;
Expand Down

0 comments on commit c56efd3

Please sign in to comment.