| 14 | |
| 15 | |
| 16 | def parse_args(): |
| 17 | parser = argparse.ArgumentParser(description="Process a PDF file.") |
| 18 | |
| 19 | # Restrict log-level to specific values |
| 20 | parser.add_argument( |
| 21 | "-l", |
| 22 | "--log-level", |
| 23 | type=str, |
| 24 | choices=["info", "warning", "error", "fatal"], |
| 25 | required=False, |
| 26 | default="error", |
| 27 | help="Log level [info, warning, error, fatal]", |
| 28 | ) |
| 29 | |
| 30 | # Restrict page-boundary |
| 31 | parser.add_argument( |
| 32 | "-b", |
| 33 | "--page-boundary", |
| 34 | type=str, |
| 35 | choices=["crop_box", "media_box"], |
| 36 | required=False, |
| 37 | default="crop_box", |
| 38 | help="page-boundary [crop_box, media_box]", |
| 39 | ) |
| 40 | |
| 41 | # Restrict page-boundary |
| 42 | parser.add_argument( |
| 43 | "-c", |
| 44 | "--category", |
| 45 | type=str, |
| 46 | # choices=["both", "original", "sanitized"], |
| 47 | choices=["all", "char", "word", "line"], |
| 48 | required=False, |
| 49 | default="char", |
| 50 | help="category [`all`, `char`, `word`, `line`]", |
| 51 | ) |
| 52 | |
| 53 | # Add an argument for the path to the PDF file |
| 54 | parser.add_argument( |
| 55 | "-i", "--input-pdf", type=str, help="Path to the PDF file", required=True |
| 56 | ) |
| 57 | |
| 58 | # Add an optional boolean argument for interactive mode |
| 59 | parser.add_argument( |
| 60 | "--interactive", |
| 61 | action="store_true", |
| 62 | help="Enable interactive mode (default: False)", |
| 63 | ) |
| 64 | |
| 65 | # Add an optional boolean argument for interactive mode |
| 66 | parser.add_argument( |
| 67 | "--display-text", |
| 68 | action="store_true", |
| 69 | help="Enable interactive mode (default: False)", |
| 70 | ) |
| 71 | |
| 72 | # Add an optional boolean argument for interactive mode |
| 73 | parser.add_argument( |