@@ -4,6 +4,7 @@ use clap::Parser;
44use colored:: Colorize ;
55use indicatif:: { ProgressBar , ProgressStyle } ;
66use pdf_to_markdown:: cache:: { CacheManager , CACHE_DISABLE_ENV_VAR } ;
7+ use pdf_to_markdown:: converter:: ConvertWithCacheOptions ;
78use pdf_to_markdown:: error:: { anyhow, Result } ;
89use pdf_to_markdown:: provider:: traits:: * ;
910use pdf_to_markdown:: provider:: ProviderType ;
@@ -630,23 +631,23 @@ async fn handle_parse(
630631 poll_interval_secs : 3 ,
631632 page_ranges : page_ranges_clone. clone ( ) ,
632633 } ;
634+ let options = ConvertWithCacheOptions {
635+ input_path : & pdf_path,
636+ input_identifier : input,
637+ output_dir : & output_dir,
638+ config : & config,
639+ provider_name : & provider_str,
640+ page_ranges,
641+ } ;
633642 converter
634- . convert_with_cache (
635- & pdf_path,
636- input,
637- & output_dir,
638- & config,
639- & provider_str,
640- page_ranges,
641- move |update| {
642- let pb = pb_clone. lock ( ) . unwrap ( ) ;
643- pb. set_message ( update. message ) ;
644- if let Some ( total) = update. total {
645- pb. set_length ( total) ;
646- }
647- pb. set_position ( update. current ) ;
648- } ,
649- )
643+ . convert_with_cache ( options, move |update| {
644+ let pb = pb_clone. lock ( ) . unwrap ( ) ;
645+ pb. set_message ( update. message ) ;
646+ if let Some ( total) = update. total {
647+ pb. set_length ( total) ;
648+ }
649+ pb. set_position ( update. current ) ;
650+ } )
650651 . await
651652 }
652653 ProviderType :: PaddleOcr => {
@@ -655,19 +656,19 @@ async fn handle_parse(
655656 // 使用默认配置:打开布局检查,关闭图片方向矫正和扭曲矫正
656657 ..Default :: default ( )
657658 } ;
659+ let options = ConvertWithCacheOptions {
660+ input_path : & pdf_path,
661+ input_identifier : input,
662+ output_dir : & output_dir,
663+ config : & config,
664+ provider_name : & provider_str,
665+ page_ranges,
666+ } ;
658667 converter
659- . convert_with_cache (
660- & pdf_path,
661- input,
662- & output_dir,
663- & config,
664- & provider_str,
665- page_ranges,
666- move |update| {
667- let pb = pb_clone. lock ( ) . unwrap ( ) ;
668- pb. set_message ( update. message ) ;
669- } ,
670- )
668+ . convert_with_cache ( options, move |update| {
669+ let pb = pb_clone. lock ( ) . unwrap ( ) ;
670+ pb. set_message ( update. message ) ;
671+ } )
671672 . await
672673 }
673674 } ?;
0 commit comments