11// SPDX-FileCopyrightText: 2024-2025 RustInFinance
22// SPDX-License-Identifier: BSD-3-Clause
33
4+
5+ // TODO: Implement PDF generation only with needed data
6+ // TODO: Implement GUI using eGUI
7+
48use clap:: Parser ;
59use lopdf:: {
610 content:: { Content , Operation } ,
@@ -20,7 +24,7 @@ struct Args {
2024 output : String ,
2125}
2226
23- /*
27+
2428fn save_text_as_pdf ( text : & str , output_path : & str ) -> lopdf:: Result < ( ) > {
2529 let mut doc = Document :: with_version ( "1.4" ) ;
2630
@@ -77,18 +81,18 @@ fn save_text_as_pdf(text: &str, output_path: &str) -> lopdf::Result<()> {
7781 doc. save ( output_path) ?;
7882 Ok ( ( ) )
7983}
80- */
84+
8185fn main ( ) {
8286 let args = Args :: parse ( ) ;
8387
84- println ! ( "Input PDF: {}" , args . input ) ;
85- /*
88+ log :: info !( "Started etradeAnonymizer" ) ;
89+ log :: info! ( "Input PDF: {}" , args . input ) ;
8690 // Load PDF
8791 let mut doc = Document :: load ( & args. input ) . expect ( "Cannot load PDF file" ) ;
88- println!("Output PDF: {}", args.output);
89- println!("Replace owner");
92+ println ! ( "Generating anonymized PDF: {} (output PDF file) based on {} (input PDF file)" , args. output, args. input) ;
9093 let first_page = doc. extract_text ( & [ 1 ] ) . expect ( "Unable to extract first page" ) ;
91- println!("First page content: {}", first_page);
94+ log:: trace!( "First page content: {}" , first_page) ;
95+ /*
9296
9397 // Next substring after "STATEMENT FOR:" is "\n<Name of owner>\n"
9498 let re = Regex::new(r"FOR:\n([^\n]+)\n").unwrap();
@@ -102,7 +106,7 @@ fn main() {
102106
103107 // Zapisz zmodyfikowany PDF
104108 // doc.save(&args.output).expect("Nie można zapisać PDF");
105- // save_text_as_pdf(&first_page, &args.output);
109+ save_text_as_pdf ( & first_page, & args. output ) ;
106110
107111 // Save without modification works fine!
108112 // Save on example.pdf PDF works fine!
0 commit comments