Skip to content

Commit e4a6ebd

Browse files
committed
Added anonymizer dummy files
1 parent e9d2759 commit e4a6ebd

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ serde = { version = "1.0.104", features = ["derive"] }
3939
roxmltree = "0.20.0"
4040
simple_logger = "4.0.0"
4141
log = "0.4.0"
42-
#clap = "~2.27.0"
4342
clap = { version = "4.5.51", features = ["derive"] }
44-
#regex = "1.3.3"
4543
regex = "1.12.2"
4644
calamine = "0.22.1"
4745
wild = "2.2.0"

src/anonymizer/anonymizer.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
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+
48
use clap::Parser;
59
use lopdf::{
610
content::{Content, Operation},
@@ -20,7 +24,7 @@ struct Args {
2024
output: String,
2125
}
2226

23-
/*
27+
2428
fn 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+
8185
fn 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

Comments
 (0)