Skip to content

Commit

Permalink
fix loop
Browse files Browse the repository at this point in the history
  • Loading branch information
linusbierhoff committed Jul 31, 2024
1 parent 59a0524 commit d7dae5f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2213,9 +2213,10 @@ pub fn extract_text_by_pages<P: std::convert::AsRef<std::path::Path>>(path: P) -
{
let mut doc = Document::load(path)?;
maybe_decrypt(&mut doc)?;
let page_num = 0;
let mut page_num = 1;
while let Ok(content) = extract_text_by_page(&doc, page_num) {
v.push(content);
page_num += 1;
}
}
Ok(v)
Expand All @@ -2226,9 +2227,10 @@ pub fn extract_text_by_pages_encrypted<P: std::convert::AsRef<std::path::Path>,
{
let mut doc = Document::load(path)?;
doc.decrypt(password)?;
let page_num = 0;
let mut page_num = 1;
while let Ok(content) = extract_text_by_page(&mut doc, page_num) {
v.push(content);
page_num += 1;
}
}
Ok(v)
Expand All @@ -2239,9 +2241,10 @@ pub fn extract_text_from_mem_by_pages(buffer: &[u8]) -> Result<Vec<String>, Outp
{
let mut doc = Document::load_mem(buffer)?;
maybe_decrypt(&mut doc)?;
let page_num = 0;
let mut page_num = 1;
while let Ok(content) = extract_text_by_page(&doc, page_num) {
v.push(content);
page_num += 1;
}
}
Ok(v)
Expand All @@ -2252,9 +2255,10 @@ pub fn extract_text_from_mem_by_pages_encrypted<PW: AsRef<[u8]>>(buffer: &[u8],
{
let mut doc = Document::load_mem(buffer)?;
doc.decrypt(password)?;
let page_num = 0;
let mut page_num = 1;
while let Ok(content) = extract_text_by_page(&doc, page_num) {
v.push(content);
page_num += 1;
}
}
Ok(v)
Expand Down

0 comments on commit d7dae5f

Please sign in to comment.